Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 7f3c054

Browse files
committed
API-486 | Fixed app log level
1 parent b7994cb commit 7f3c054

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/KibanaFormatterServiceProvider.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,15 @@ class KibanaFormatterServiceProvider extends ServiceProvider
1616
*/
1717
public function boot()
1818
{
19-
$logPath = storage_path().'/logs/log_'. date('Y-m-d-H') .'.json';
20-
$handler = new StreamHandler($logPath);
21-
$handler->setFormatter(new KibanaFormatter(env('KIBANA_FORMATTER_APPLICATION_NAME','php-api')));
19+
$dir = config('kibana-logger.log-path', storage_path('logs'));
20+
$fileNameTemplate = config('kibana-logger.log-file-name-template', 'log_'. date('Y-m-d-H') .'.json');
21+
$logLevel = config('app.log_level', 'debug');
22+
$applicationName = config('kibana-logger.application-name', 'php-api');
23+
24+
$logPath = $dir.DIRECTORY_SEPARATOR.$fileNameTemplate;
25+
26+
$handler = new StreamHandler($logPath, $logLevel);
27+
$handler->setFormatter(new KibanaFormatter($applicationName));
2228

2329
$monolog = Log::getMonolog();
2430
$monolog->pushHandler($handler);

0 commit comments

Comments
 (0)