Skip to content

Commit 4522097

Browse files
committed
🔧 Add configuration for the logging handler
1 parent 42b670e commit 4522097

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

‎config/logging.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,11 @@
6262
'driver' => 'monolog',
6363
'handler' => Laracord\Logging\LoggingHandler::class,
6464
'with' => [
65-
'path' => laracord_path('logs/laracord.log'),
65+
'path' => env('LOG_PATH', laracord_path('logs/laracord.log')),
6666
'level' => env('LOG_LEVEL', 'info'),
67+
'maxSize' => env('LOG_MAX_SIZE', 10),
68+
'maxFiles' => env('LOG_MAX_FILES', 5),
69+
'flushInterval' => env('LOG_FLUSH_INTERVAL', 60),
6770
],
6871
],
6972

‎src/Logging/LoggingHandler.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,16 @@ class LoggingHandler extends AbstractProcessingHandler
3232
*/
3333
public function __construct(
3434
protected string $path,
35-
protected int $maxSize = 10485760,
35+
protected int $maxSize = 10,
3636
protected int $maxFiles = 5,
3737
protected float $flushInterval = 60,
3838
mixed $level = Level::Debug,
3939
bool $bubble = true,
4040
) {
4141
parent::__construct($level, $bubble);
4242

43+
$this->maxSize *= 1024 * 1024;
44+
4345
$this->initializeStream();
4446
}
4547

0 commit comments

Comments
 (0)