Skip to content

Commit

Permalink
Merge pull request #1 from pdffiller/pae-api_486-fix-log-level
Browse files Browse the repository at this point in the history
API-486 | Fixed app log level
  • Loading branch information
apictapx authored Jun 17, 2016
2 parents b7994cb + 7f3c054 commit c1ef7eb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/KibanaFormatterServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ class KibanaFormatterServiceProvider extends ServiceProvider
*/
public function boot()
{
$logPath = storage_path().'/logs/log_'. date('Y-m-d-H') .'.json';
$handler = new StreamHandler($logPath);
$handler->setFormatter(new KibanaFormatter(env('KIBANA_FORMATTER_APPLICATION_NAME','php-api')));
$dir = config('kibana-logger.log-path', storage_path('logs'));
$fileNameTemplate = config('kibana-logger.log-file-name-template', 'log_'. date('Y-m-d-H') .'.json');
$logLevel = config('app.log_level', 'debug');
$applicationName = config('kibana-logger.application-name', 'php-api');

$logPath = $dir.DIRECTORY_SEPARATOR.$fileNameTemplate;

$handler = new StreamHandler($logPath, $logLevel);
$handler->setFormatter(new KibanaFormatter($applicationName));

$monolog = Log::getMonolog();
$monolog->pushHandler($handler);
Expand Down

0 comments on commit c1ef7eb

Please sign in to comment.