Skip to content

Commit

Permalink
Change default settings to avoid memory-overflow and dropped logs
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrHeinz committed Jun 26, 2024
1 parent d8e9ba3 commit 451ea78
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions src/Monolog/LogtailHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
*/
class LogtailHandler extends BufferHandler
{
const DEFAULT_BUBBLE = true;
const DEFAULT_BUFFER_LIMIT = 1000;
const DEFAULT_FLUSH_ON_OVERFLOW = true;
const DEFAULT_ALWAYS_FLUSH_AFTER_MILLISECONDS = 1000;

/**
Expand All @@ -45,10 +48,10 @@ class LogtailHandler extends BufferHandler
public function __construct(
$sourceToken,
$level = Logger::DEBUG,
$bubble = true,
$bubble = self::DEFAULT_BUBBLE,
$endpoint = LogtailClient::URL,
$bufferLimit = 0,
$flushOnOverflow = false,
$bufferLimit = self::DEFAULT_BUFFER_LIMIT,
$flushOnOverflow = self::DEFAULT_FLUSH_ON_OVERFLOW,
$connectionTimeoutMs = LogtailClient::DEFAULT_CONNECTION_TIMEOUT_MILLISECONDS,
$timeoutMs = LogtailClient::DEFAULT_TIMEOUT_MILLISECONDS,
$alwaysFlushAfterMs = self::DEFAULT_ALWAYS_FLUSH_AFTER_MILLISECONDS
Expand Down
6 changes: 3 additions & 3 deletions src/Monolog/LogtailHandlerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ final class LogtailHandlerBuilder
{
private $sourceToken;
private $level = Logger::DEBUG;
private $bubble = true;
private $bubble = LogtailHandler::DEFAULT_BUBBLE;
private $endpoint = LogtailClient::URL;
private $bufferLimit = 0;
private $flushOnOverflow = false;
private $bufferLimit = LogtailHandler::DEFAULT_BUFFER_LIMIT;
private $flushOnOverflow = LogtailHandler::DEFAULT_FLUSH_ON_OVERFLOW;
private $connectionTimeoutMs = LogtailClient::DEFAULT_CONNECTION_TIMEOUT_MILLISECONDS;
private $timeoutMs = LogtailClient::DEFAULT_TIMEOUT_MILLISECONDS;
private $alwaysFlushAfterMs = LogtailHandler::DEFAULT_ALWAYS_FLUSH_AFTER_MILLISECONDS;
Expand Down
2 changes: 1 addition & 1 deletion src/Monolog/SynchronousLogtailHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SynchronousLogtailHandler extends \Monolog\Handler\AbstractProcessingHandl
public function __construct(
$sourceToken,
$level = \Monolog\Logger::DEBUG,
$bubble = true,
$bubble = LogtailHandler::DEFAULT_BUBBLE,
$endpoint = LogtailClient::URL,
$connectionTimeoutMs = LogtailClient::DEFAULT_CONNECTION_TIMEOUT_MILLISECONDS,
$timeoutMs = LogtailClient::DEFAULT_TIMEOUT_MILLISECONDS
Expand Down

0 comments on commit 451ea78

Please sign in to comment.