public function terminate($request, $response)
 {
     $log = new Logger('HTTP');
     $handler = new RotatingFileHandler(config('laravelmiddlewarelogger.options.file'), Logger::INFO);
     $handler->setFormatter(new LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context%\n\n"));
     $log->pushHandler($handler);
     if (config('laravelmiddlewarelogger.options.enabled')) {
         $inputs = $request->input();
         if (!empty($inputs)) {
             $inputSafe = config('laravelmiddlewarelogger.options.input_safe');
             foreach ($inputSafe as $safe) {
                 if (!empty($inputs[$safe])) {
                     $inputs[$safe] = '[*** SENSOR ***]';
                 }
             }
         }
         $request_array = ['method' => $request->method(), 'full-url' => $request->fullUrl(), 'client-ip' => $request->ip(), 'user-agent' => $request->header('user-agent'), 'query-string' => $request->query(), 'inputs' => $inputs];
         $response_array = [];
         if (config('laravelmiddlewarelogger.options.log_response')) {
             $response_array = ['status' => $response->status(), 'content' => ''];
             json_decode($response->content());
             if (json_last_error() == JSON_ERROR_NONE) {
                 $response_array['content'] = $response->content();
             }
         }
         $log->addInfo('REQUEST', $request_array);
         $log->addInfo('RESPONSE', $response_array);
     }
 }
Exemplo n.º 2
0
 private function setHande()
 {
     date_default_timezone_set("PRC");
     self::$log = new Logger('name');
     $rotating = new RotatingFileHandler($this->filepath, $this->log_keepDays, $this->log_level);
     $rotating->setFormatter($this->formatter);
     self::$log->pushHandler($rotating);
 }
Exemplo n.º 3
0
 public static function init($channel, $filename)
 {
     $logger = new MongoLog($channel);
     $stream = new RotatingFileHandler($filename, 0, MongoLog::DEBUG);
     $stream->setFormatter(new LineFormatter("%datetime% [%channel%] %level_name% %message% %context%\n", "Y-m-d H:i:s"));
     $logger->pushHandler($stream);
     static::$object = $logger;
 }
 public static function configureFileLogs(Monolog $monolog, $filePath)
 {
     $files = new RotatingFileHandler($filePath, 365, Logger::DEBUG, true, 0666);
     $files->setFormatter(new HtmlFormatter());
     $files->pushProcessor(new WebProcessor());
     $files->pushProcessor(new IntrospectionProcessor(Logger::DEBUG));
     $monolog->pushHandler($files);
 }
Exemplo n.º 5
0
 /**
  * Class constructor
  *
  * @param string $loggerName Logger name (the logging channel)
  * @param int $logLevel The minimum logging level at logging handler will be triggered
  * @param string $fileName Log file name
  */
 private function __construct($loggerName = DEFAULT_LOGGER_NAME, $logLevel = MIN_LOG_LEVEL, $fileName = DEFAULT_LOG_PATH . DEFAULT_LOG_FILE)
 {
     $fullLogFilePath = $fileName;
     $formatter = new LineFormatter(null, null, false, true);
     $this->_logger = new Logger($loggerName);
     $handler = new RotatingFileHandler($fullLogFilePath, MAX_LOG_FILES_TO_KEEP, $logLevel);
     $handler->setFormatter($formatter);
     $this->_logger->pushHandler($handler);
 }
 public function testReuseCurrentFile()
 {
     $log = __DIR__ . '/Fixtures/foo-' . date('Y-m-d') . '.rot';
     file_put_contents($log, "foo");
     $handler = new RotatingFileHandler(__DIR__ . '/Fixtures/foo.rot');
     $handler->setFormatter($this->getIdentityFormatter());
     $handler->handle($this->getRecord());
     $this->assertEquals('footest', file_get_contents($log));
 }
 private function logger()
 {
     $log = new Logger("slim");
     $formatter = new LineFormatter("[%datetime%] [%level_name%]: %message%\n");
     $rotating = new RotatingFileHandler(__DIR__ . "/../../logs/slim.log", 0, Logger::DEBUG);
     $rotating->setFormatter($formatter);
     $log->pushHandler($rotating);
     return new MonologSQLLogger($log);
 }
Exemplo n.º 8
0
 private function configureLogger()
 {
     $dateFormat = 'Y-m-d H:i:s';
     $logFormat = "%datetime% %level_name% |[%codeInfo%] %message%\n";
     $formatter = new LineFormatter($logFormat, $dateFormat);
     $rotatingLogger = new RotatingFileHandler($this->logPath, 30);
     $rotatingLogger->setFormatter($formatter);
     $this->pushHandler($rotatingLogger);
     $this->pushProcessor(new IntrospectionProcessor());
 }
Exemplo n.º 9
0
 /**
  * @return array
  */
 public function addDefaultLoggerDataProvider()
 {
     $logHandler1 = new RotatingFileHandler(Http::DEFAULT_LOG_FILE_NAME);
     $logHandler1->setFormatter(new LineFormatter(Http::DEFAULT_LOG_LINE_FORMAT, null, true));
     $logHandler2 = new RotatingFileHandler('fileName');
     $logHandler2->setFormatter(new LineFormatter('%message%', null, true));
     return ['Default params' => ['fileName' => null, 'lineFormat' => null, 'messageFormat' => null, 'logLevel' => LogLevel::INFO, 'logger' => new Logger('Logger', [$logHandler1]), 'messageFormatter' => new MessageFormatter(Http::DEFAULT_LOG_MESSAGE_FORMAT), 'middlewareCallback' => function () {
     }], 'Custom params' => ['fileName' => 'fileName', 'lineFormat' => '%message%', 'messageFormat' => '{code}', 'logLevel' => LogLevel::NOTICE, 'logger' => new Logger('Logger', [$logHandler2]), 'messageFormatter' => new MessageFormatter('{code}'), 'middlewareCallback' => function () {
     }]];
 }
Exemplo n.º 10
0
 /**
  * Here it's using Monolog for writing logs
  *
  * @param int  $level  Log level
  *
  * @return \Monolog\Logger
  */
 public static function getLogger($level = Logger::DEBUG)
 {
     $config = self::getConfig();
     $logger = new Logger($config['log']['channelName']);
     if (!is_dir($config['log']['baseDirectory'])) {
         mkdir($config['log']['baseDirectory'], 0777);
     }
     $handler = new RotatingFileHandler($config['log']['baseDirectory'] . 'messages.log', $config['log']['maxFilesRotation'], $level);
     $handler->setFormatter(new LineFormatter($config['log']['format']));
     $logger->pushHandler($handler);
     return $logger;
 }
Exemplo n.º 11
0
 /**
  * @param string $stream
  * @param string $path
  * @param mixed $level
  * @param string $format
  * @param $errorPath
  * @return LoggerInterface
  */
 protected function createLogger($stream, $path, $level, $format, $errorPath)
 {
     $defaultHandler = new RotatingFileHandler($path, 0, $level);
     $defaultHandler->setFormatter(new LineFormatter($format));
     $logger = new MonologWrapper($stream, array($defaultHandler));
     if ($path !== $errorPath) {
         $errorHandler = new RotatingFileHandler($errorPath, 0, Logger::ERROR);
         $errorHandler->setFormatter(new LineFormatter($format));
         $logger->pushHandler($errorHandler);
     }
     return $logger;
 }
Exemplo n.º 12
0
 /**
  * @return Logger
  */
 protected function getJobLogger()
 {
     $jobLogger = new Logger('Jobs');
     $lineFormatter = new LineFormatter("[%datetime%] %message% %context% %extra%\n", null, true, true);
     $streamHandler = new StreamHandler("php://output");
     $streamHandler->setFormatter($lineFormatter);
     $jobLogger->pushHandler($streamHandler);
     $fileHandler = new RotatingFileHandler(storage_path() . '/logs/jobs.log');
     $fileHandler->setFormatter($lineFormatter);
     $jobLogger->pushHandler($fileHandler);
     $jobLogger->debug(static::class);
     return $jobLogger;
 }
Exemplo n.º 13
0
 /**
  * @return \Monolog\Logger
  */
 private function getPhealLogger()
 {
     // If its already setup, just return it.
     if (!is_null($this->logger)) {
         return $this->logger;
     }
     // Configure the logger by setting the logfile
     // path and the format logs should be.
     $log_file = storage_path('logs/pheal.log');
     $format = new LineFormatter(null, null, false, true);
     $stream = new RotatingFileHandler($log_file, 30, Logger::INFO);
     $stream->setFormatter($format);
     $this->logger = new Logger('pheal');
     $this->logger->pushHandler($stream);
     return $this->logger;
 }
Exemplo n.º 14
0
 public function __construct()
 {
     $this->path = MAIN_DIRECTORY . DIRECTORY_SEPARATOR . 'log';
     if (!is_dir($this->path)) {
         File::createDirectory($this->path, $this->dirMode, true);
     }
     $this->logFile = $this->path . DIRECTORY_SEPARATOR . 'app.log';
     $this->log = new Logger('app');
     $webProcessor = new WebProcessor();
     $format = "[%datetime%] %channel%.%level_name%: %message% %extra.ip% %extra.http_method% %context% %extra%\n";
     $formatter = new LineFormatter($format, null, true);
     $logRotate = new RotatingFileHandler($this->logFile, 45, Logger::INFO, true, 0777);
     $logRotate->setFormatter($formatter);
     $this->log->pushHandler($logRotate);
     $this->log->pushProcessor($webProcessor);
 }
Exemplo n.º 15
0
 public function addLogger($name, $logToSystemFile = true)
 {
     if (!empty($this->loggers[$name])) {
         return;
     }
     $this->setFormatter();
     $this->loggers[$name] = new Logger($name);
     if ($logToSystemFile === true) {
         $filename = ROOT_PATH . "/log/" . LogService::$system_logger . ".log";
     } else {
         $filename = ROOT_PATH . "/log/{$name}.log";
     }
     $handler = new RotatingFileHandler($filename);
     $handler->setFormatter($this->formatter);
     // $handler->setFormatter(new JsonFormatter());
     $this->loggers[$name]->pushHandler($handler);
 }
 public function register(Application $app)
 {
     $app->register(new \Silex\Provider\MonologServiceProvider());
     $app['monolog.handler'] = function () use($app) {
         $levels = Logger::getLevels();
         if ($app['debug']) {
             $level = Logger::DEBUG;
         } else {
             $level = $app['config']['log']['log_level'];
         }
         $RotateHandler = new RotatingFileHandler($app['monolog.logfile'], $app['config']['log']['max_files'], $level);
         $RotateHandler->setFilenameFormat($app['config']['log']['prefix'] . '{date}' . $app['config']['log']['suffix'], $app['config']['log']['format']);
         $RotateHandler->setFormatter(new LineFormatter(null, null, true));
         $FingerCrossedHandler = new FingersCrossedHandler($RotateHandler, new ErrorLevelActivationStrategy($levels[$app['config']['log']['action_level']]));
         return $FingerCrossedHandler;
     };
     $app['listener.requestdump'] = $app->share(function ($app) {
         return new \Eccube\EventListener\RequestDumpListener($app);
     });
 }
Exemplo n.º 17
0
 public function register(Container $app)
 {
     $app['logger'] = function () use($app) {
         return $app['monolog'];
     };
     $app['monolog'] = function ($app) {
         $logger = new Logger($app['monolog.name']);
         $rotate = $app['config']->get('app.log.rotate', 'single');
         $logger->pushHandler($app['monolog.handler.' . $rotate]);
         return $logger;
     };
     $app['monolog.formatter'] = function () {
         return new LineFormatter();
     };
     $app['monolog.handler.single'] = function ($app) {
         $handler = new StreamHandler($app['monolog.logfile'], $app['monolog.level']);
         $handler->setFormatter($app['monolog.formatter']);
         return $handler;
     };
     $app['monolog.handler.daily'] = function ($app) {
         $maxFiles = $app['config']->get('app.log.max_files', 5);
         $handler = new RotatingFileHandler($app['monolog.logfile'], $maxFiles, $app['monolog.level']);
         $handler->setFormatter($app['monolog.formatter']);
         return $handler;
     };
     $app['monolog.handler.error'] = function ($app) {
         $handler = new ErrorLogHandler(ErrorLogHandler::OPERATING_SYSTEM, $app['monolog.level']);
         $handler->setFormatter($app['monolog.formatter']);
         return $handler;
     };
     $app['monolog.handler.syslog'] = function ($app) {
         $handler = new SyslogHandler($app['monolog.name'], LOG_USER, $app['monolog.level']);
         $handler->setFormatter($app['monolog.formatter']);
         return $handler;
     };
     $level = $app['config']->get('app.log.level', 'debug');
     $app['monolog.level'] = $this->parseLevel($level);
     $app['monolog.logfile'] = $app['path.logs'] . $this->getSettings('app.log.logfile');
     $app['monolog.name'] = $this->getSettings('monolog.name', 'app.name');
 }
Exemplo n.º 18
0
 /**
  * BaseTestCase constructor.
  *
  * @param null   $name
  * @param array  $data
  * @param string $dataName
  *
  * @author Andreas Glaser
  */
 public function __construct($name = null, array $data = [], $dataName = '')
 {
     parent::__construct($name, $data, $dataName);
     $this->config = parse_ini_file(__DIR__ . '/../../config.ini', true);
     // overwrite default configuration with custom values if available
     if (file_exists(__DIR__ . '/../../config-custom.ini') && is_readable(__DIR__ . '/../../config-custom.ini')) {
         $configCustom = parse_ini_file(__DIR__ . '/../../config-custom.ini', true);
         $this->config = array_replace_recursive($this->config, $configCustom);
     }
     $config = $this->config['client'];
     $config['headers'] = $this->config['client.headers'];
     $this->client = new Client($config);
     // attach logger if necessary
     if ($this->config['general']['logging.enabled']) {
         $logger = new Logger('default');
         $handler = new RotatingFileHandler(__DIR__ . '/../../logs/client.log', 2);
         $handler->setFormatter(new LineFormatter(null, null, true));
         $logger->pushHandler($handler);
         $this->client->attachLogger($logger);
     }
     $this->faker = Faker\Factory::create();
     $this->init();
 }
Exemplo n.º 19
0
 public function useDailyFiles($path, $days = 0, $level = 'debug')
 {
     $level = $this->parseLevel($level);
     $this->monolog->pushHandler($handler = new RotatingFileHandler($path, $days, $level));
     $handler->setFormatter($this->getDefaultFormatter());
 }
Exemplo n.º 20
0
 /**
  * Register a rotating file log handler.
  *
  * @param  string  $level
  * @param  string  $path
  * @return void
  */
 public function useRotatingFiles($level = 'debug', $path = null)
 {
     $path || ($path = $this->settings['directory']);
     $this->monolog->pushHandler($handler = new Handler\RotatingFileHandler($path, 5, Logger::toMonologLevel($level)));
     $handler->setFormatter($this->getDefaultFormatter());
     return $this;
 }
Exemplo n.º 21
0
 /**
  * log.ymlの内容に応じたHandlerの設定を行う
  *
  * @param array $channelValues
  * @return FingersCrossedHandler
  */
 public function getHandler(array $channelValues)
 {
     $app = $this->app;
     $levels = Logger::getLevels();
     // ファイル名などの設定を行い、設定がなければデフォルト値を設定
     $logFileName = isset($channelValues['filename']) ? $channelValues['filename'] : $app['config']['log']['filename'];
     $delimiter = isset($channelValues['delimiter']) ? $channelValues['delimiter'] : $app['config']['log']['delimiter'];
     $dateFormat = isset($channelValues['dateformat']) ? $channelValues['dateformat'] : $app['config']['log']['dateformat'];
     $logLevel = isset($channelValues['log_level']) ? $channelValues['log_level'] : $app['config']['log']['log_level'];
     $actionLevel = isset($channelValues['action_level']) ? $channelValues['action_level'] : $app['config']['log']['action_level'];
     $passthruLevel = isset($channelValues['passthru_level']) ? $channelValues['passthru_level'] : $app['config']['log']['passthru_level'];
     $maxFiles = isset($channelValues['max_files']) ? $channelValues['max_files'] : $app['config']['log']['max_files'];
     $logDateFormat = isset($channelValues['log_dateformat']) ? $channelValues['log_dateformat'] : $app['config']['log']['log_dateformat'];
     $logFormat = isset($channelValues['log_format']) ? $channelValues['log_format'] : $app['config']['log']['log_format'];
     if ($app['debug']) {
         $level = Logger::DEBUG;
     } else {
         $level = $logLevel;
     }
     // RotateHandlerの設定
     $filename = $app['config']['root_dir'] . '/app/log/' . $logFileName . '.log';
     $RotateHandler = new RotatingFileHandler($filename, $maxFiles, $level);
     $RotateHandler->setFilenameFormat($logFileName . $delimiter . '{date}' . $app['config']['log']['suffix'], $dateFormat);
     // ログフォーマットの設定(設定ファイルで定義)
     $RotateHandler->setFormatter(new LineFormatter($logFormat . PHP_EOL, $logDateFormat, true, true));
     // FingerCossedHandlerの設定
     $FingerCrossedHandler = new FingersCrossedHandler($RotateHandler, new ErrorLevelActivationStrategy($levels[$actionLevel]), 0, true, true, $levels[$passthruLevel]);
     // Processorの内容をログ出力
     $webProcessor = new WebProcessor();
     $uidProcessor = new UidProcessor(8);
     $FingerCrossedHandler->pushProcessor(function ($record) use($app, $uidProcessor, $webProcessor) {
         // ログフォーマットに出力する値を独自に設定
         $record['level_name'] = sprintf("%-5s", $record['level_name']);
         // セッションIDと会員IDを設定
         $record['session_id'] = null;
         $record['user_id'] = null;
         if ($app->isBooted()) {
             if (isset($app['session'])) {
                 $sessionId = $app['session']->getId();
                 if ($sessionId) {
                     $record['session_id'] = substr(sha1($sessionId), 0, 8);
                 }
             }
             if (isset($app['user'])) {
                 $user = $app->user();
                 if ($user instanceof Customer || $user instanceof Member) {
                     $record['user_id'] = $user->getId();
                 }
             }
         }
         $record['uid'] = $uidProcessor->getUid();
         $record['url'] = $webProcessor->getRequestUri();
         $record['ip'] = $webProcessor->getClientIp();
         $record['referrer'] = $webProcessor->getReferer();
         $record['method'] = $webProcessor->getMethod();
         $record['user_agent'] = $webProcessor->getUserAgent();
         // クラス名などを一旦保持し、不要な情報は削除
         $line = $record['extra']['line'];
         $functionName = $record['extra']['function'];
         // php5.3だとclass名が取得できないため、ファイル名を元に出力
         // $className = $record['extra']['class'];
         $className = $record['extra']['file'];
         // 不要な情報を削除
         unset($record['extra']['file']);
         unset($record['extra']['line']);
         unset($record['extra']['class']);
         unset($record['extra']['function']);
         $record['class'] = pathinfo($className, PATHINFO_FILENAME);
         $record['function'] = $functionName;
         $record['line'] = $line;
         return $record;
     });
     // クラス名等を取得するProcessor、ログ出力時にクラス名/関数名を無視するための設定を行っている
     $skipClasses = array('Psr\\Log\\', 'Eccube\\Log\\');
     $skipFunctions = array('log_info', 'log_notice', 'log_warning', 'log_error', 'log_critical', 'log_alert', 'log_emergency');
     $intro = new IntrospectionProcessor(Logger::DEBUG, $skipClasses, $skipFunctions);
     $FingerCrossedHandler->pushProcessor($intro);
     return $FingerCrossedHandler;
 }
Exemplo n.º 22
0
 /**
  * Enable logger output
  *
  * @return void
  */
 public function enable()
 {
     error_reporting(E_ALL | E_STRICT);
     $this->activated = true;
     if (!$this->monolog) {
         // Create the logger
         $this->monolog = new \Monolog\Logger('app');
         $proc = new WebProcessor();
         $this->monolog->pushProcessor($proc);
         $this->monolog->pushProcessor(array($this, 'xoopsDataProcessor'));
         $formatter = new LineFormatter();
         //$formatter = new LogstashFormatter;
         switch ($this->configs['logging_threshold']) {
             case 'error':
                 $threshold = MLogger::ERROR;
                 break;
             case 'warning':
                 $threshold = MLogger::WARNING;
                 break;
             case 'info':
                 $threshold = MLogger::INFO;
                 break;
             case 'debug':
             default:
                 $threshold = MLogger::DEBUG;
                 break;
         }
         if ((int) $this->configs['max_versions'] == 0) {
             $stream = new StreamHandler($this->configs['log_file_path'], $threshold);
         } else {
             $stream = new RotatingFileHandler($this->configs['log_file_path'], $this->configs['max_versions'], $threshold);
         }
         $stream->setFormatter($formatter);
         $this->monolog->pushHandler($stream);
     }
     //if ($this->monolog && $this->configs['phpfire_enable']) {
     //    $firephp = new FirePHPHandler();
     //    $this->monolog->pushHandler($firephp);
     //}
 }
Exemplo n.º 23
0
 /**
  * @param string|null $fileName
  * @param string|null $lineFormat
  * @param string|null $messageFormat
  * @param string|null $logLevel
  * @return Http
  */
 public function addDefaultLogger($fileName = null, $lineFormat = null, $messageFormat = null, $logLevel = null)
 {
     $fileName = $fileName ?: static::DEFAULT_LOG_FILE_NAME;
     $lineFormat = $lineFormat ?: static::DEFAULT_LOG_LINE_FORMAT;
     $messageFormat = $messageFormat ?: static::DEFAULT_LOG_MESSAGE_FORMAT;
     $logLevel = $logLevel ?: LogLevel::INFO;
     $logHandler = new RotatingFileHandler($fileName);
     $logHandler->setFormatter(new LineFormatter($lineFormat, null, true));
     return $this->addLogger(new Logger('Logger', [$logHandler]), new MessageFormatter($messageFormat), $logLevel);
 }
Exemplo n.º 24
0
<?php

use Monolog\Logger;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\NullHandler;
use Monolog\Formatter\LineFormatter;
$container = $app->getContainer();
$container["logger"] = function ($c) {
    $logger = new Logger("slim");
    $formatter = new LineFormatter("[%datetime%] [%level_name%]: %message% %context%\n", null, true, true);
    /* Log to timestamped files */
    $rotating = new RotatingFileHandler(__DIR__ . "/../logs/slim.log", 0, Logger::DEBUG);
    $rotating->setFormatter($formatter);
    $logger->pushHandler($rotating);
    return $logger;
};
Exemplo n.º 25
0
 /**
  * Create new logger instance with given
  * configuration and store it in array
  * with channel name
  *
  * @param  string $channel Channel name
  * @param  array $config  Channel configuration
  * @return void
  */
 private function createLogger($channel, array $config)
 {
     // Setup configuration
     // Use default laravel logs path
     $storagePath = $this->app->make('path.storage');
     $filepath = $storagePath . '/logs/' . $config['stream'];
     $logger = new Logger($channel);
     $handler = new StreamHandler($filepath);
     // Daily rotation
     if ($config['daily']) {
         $handler = new RotatingFileHandler($filepath, 1);
     }
     // Format line
     if (isset($config['format'])) {
         $format = $config['format'];
         $handler->setFormatter(new LineFormatter($format['output'], $format['date']));
     }
     $logger->pushHandler($handler);
     $this->channels[$channel] = $logger;
 }
Exemplo n.º 26
0
 /**
  * Register a daily file log handler.
  *
  * @param   string  $path
  * @param   int     $days
  * @param   string  $level
  * @param   string  $format
  * @return  void
  */
 public function useDailyFiles($path, $days = 0, $level = 'debug', $format = '', $dateFormat = 'Y-m-d H:i:s', $permissions = null)
 {
     $level = $this->parseLevel($level);
     $handler = new RotatingFileHandler($path, $days, $level, true, $permissions);
     if ($format) {
         $handler->setFormatter(new LineFormatter($format, $dateFormat));
     }
     $this->monolog->pushHandler($handler);
 }
Exemplo n.º 27
0
 /**
  * Register a rotating file log handler.
  *
  * @param  mixed       $level
  * @param  null|string $filename
  * @return \Projek\Slim\Monolog
  */
 public function useRotatingFiles($level = Logger::DEBUG, $filename = null)
 {
     $filename || ($filename = $this->name . '.log');
     $path = $this->settings['directory'] . '/' . $filename;
     $this->monolog->pushHandler($handler = new Handler\RotatingFileHandler($path, 5, $level));
     $handler->setFormatter($this->getDefaultFormatter());
     return $this;
 }
Exemplo n.º 28
0
 public function logToDailyFiles($path, $keepFiles = 0, $defaultLevel = 'debug')
 {
     $level = $this->parseLevel($defaultLevel);
     $this->monolog->pushHandler($handler = new RotatingFileHandler($path, $keepFiles, $level));
     $handler->setFormatter(new LineFormatter());
 }