public function register(Neptune $neptune)
 {
     $neptune['logger.name'] = function ($neptune) {
         return $neptune['config']->get('monolog.name', 'neptune');
     };
     $neptune['logger.path'] = function ($neptune) {
         return $neptune['config']->getRequired('monolog.path');
     };
     $neptune['logger.level'] = function ($neptune) {
         $level = $neptune['config']->get('monolog.level', Logger::DEBUG);
         if (is_int($level)) {
             return $level;
         }
         $level = strtoupper($level);
         $levels = Logger::getLevels();
         if (!isset($levels[$level])) {
             throw new \InvalidArgumentException("Invalid log level {$level} provided");
         }
         return $levels[$level];
     };
     $neptune['logger'] = function ($neptune) {
         $logger = new Logger($neptune['logger.name']);
         $logger->pushHandler(new StreamHandler($neptune['logger.path'], $neptune['logger.level']));
         return $logger;
     };
     $neptune['logger.exception_listener'] = function ($neptune) {
         return new LoggerExceptionListener($neptune['logger']);
     };
 }
Exemple #2
0
 /**
  * Register this plates view provider with a Pimple container
  *
  * @param string $name
  * @param array  $settings
  */
 public function __construct($name = 'slim-app', $settings = [])
 {
     $this->name = $name;
     $this->monolog = new Logger($this->name);
     $this->settings = array_merge($this->settings, $settings);
     if (null !== $this->settings['timezone']) {
         if (is_string($this->settings['timezone'])) {
             $this->settings['timezone'] = new \DateTimeZone($this->settings['timezone']);
         }
         Logger::setTimezone($this->settings['timezone']);
     }
     $this->monolog->setHandlers($this->settings['handlers']);
     $levels = array_keys(Logger::getLevels());
     if (!in_array(strtoupper($this->settings['level']), $levels)) {
         $this->settings['level'] = 'debug';
     }
     if ($path = $this->settings['directory']) {
         if ($path === 'syslog') {
             $this->useSyslog($this->name, $this->settings['level']);
         } elseif (is_dir($path)) {
             $path .= '/' . $this->name;
             $this->useRotatingFiles($path, $this->settings['level']);
         }
     }
 }
 /**
  * SlackMessageFormatter constructor.
  * @param SlackMessage $initialMessage
  * @param array $colorMap
  */
 public function __construct(SlackMessage $initialMessage, array $colorMap = [])
 {
     $this->slackMessage = $initialMessage;
     if (count($colorMap) == count(Logger::getLevels())) {
         $this->color = $colorMap;
     }
 }
 /**
  * Get log level.
  *
  * @return int
  *
  * @author Wuhsien Yu <*****@*****.**>
  *
  * @since  2016/03/12
  */
 protected static function getLevel()
 {
     $level = Logger::toMonologLevel(Config::get('log.level'));
     if (!in_array($level, Logger::getLevels())) {
         $level = Logger::INFO;
     }
     return $level;
 }
Exemple #5
0
 /**
  * @param string $priority
  * @return int
  */
 protected function getLevel($priority)
 {
     if (isset($this->priorityMap[$priority])) {
         return $this->priorityMap[$priority];
     }
     $levels = $this->monolog->getLevels();
     return isset($levels[$uPriority = strtoupper($priority)]) ? $levels[$uPriority] : Monolog\Logger::INFO;
 }
Exemple #6
0
 /**
  * @param string $levelName The log level: debug|info|notice|warning|error|critical|alert|emergency
  * @return mixed
  */
 protected function mapLevel($levelName)
 {
     $levels = Logger::getLevels();
     if (array_key_exists(strtoupper($levelName), $levels)) {
         return $levels[strtoupper($levelName)];
     }
     return Logger::INFO;
 }
 /**
  * Data provider that produce a suite of records in level order.
  *
  * @return array
  * @see GrowlHandlerTest::testIsHandling()
  * @see GrowlHandlerTest::testIsHandlingLevel()
  * @see GrowlHandlerTest::testHandleProcessOnlyNeededLevels()
  * @see GrowlHandlerTest::testHandleProcessAllMatchingRules()
  */
 public function provideSuiteRecords()
 {
     $dataset = array();
     foreach (Logger::getLevels() as $level_name => $level_code) {
         $dataset[] = $this->getRecord($level_code, sprintf('sample of %s message', $level_name));
     }
     return $dataset;
 }
 /**
  * Set the Color Scheme Array
  * @param array $colorScheme The Color Scheme Array
  */
 public function setColorizeArray(array $colorScheme)
 {
     // Only store entries that exist as Monolog\Logger levels
     $allowedLogLevels = array_values(\Monolog\Logger::getLevels());
     $colorScheme = array_intersect_key($colorScheme, array_flip($allowedLogLevels));
     // Store the filtered colorScheme
     $this->colorScheme = $colorScheme;
 }
 /**
  * Provides default options for all commands. This function should be called explicitly (i.e. parent::configure())
  * if the configure function is overridden.
  */
 protected function configure()
 {
     $this->runtimeConfig = new RuntimeConfig($this);
     $this->advanceExecutionPhase(RuntimeConfig::PHASE_CONFIGURE);
     parent::configure();
     $this->addOption('log-level', 'l', InputOption::VALUE_REQUIRED, 'Override the Monolog logging level for this execution of the command. Valid values: ' . implode(',', array_keys(Logger::getLevels())))->addOption('log-filename', null, InputOption::VALUE_REQUIRED, 'Specify a different file (relative to the ' . 'kernel log directory) to send file logs to')->addOption('locking', null, InputOption::VALUE_REQUIRED, 'Switches locking on/off');
     $this->advanceExecutionPhase(RuntimeConfig::PHASE_POST_CONFIGURE);
 }
Exemple #10
0
 /**
  * @param Request $request
  * @param Application $app
  *
  * @return mixed
  */
 public function index(Request $request, Application $app)
 {
     $viewer = new LogViewer();
     $log = $viewer->getLog('elprecursor', 'log');
     if ($log === false) {
         return $app->redirect($app['url_generator']->generate('client', array('clientSlug' => $clientSlug)));
     }
     return $app['twig']->render('backend/log/list.html.twig', array('clients' => $viewer->getClients(), 'logs' => $viewer->getLogs('elprecursor'), 'clientSlug' => $clientSlug, 'logSlug' => 'log', 'log' => $log, 'logLevels' => Logger::getLevels(), 'minLogLevel' => 0));
 }
Exemple #11
0
 protected function isTriggered(Entry $entry)
 {
     $emailLevel = env('LOGGER_EMAIL_LEVEL', false);
     if (!$emailLevel || $this->config->get('app.debug')) {
         return false;
     }
     $emailLevelCode = MonologLogger::getLevels()[$emailLevel];
     return $entry->getCode() >= $emailLevelCode;
 }
Exemple #12
0
 /**
  * @param int $level
  *
  * @return self
  */
 private function setLevel($level)
 {
     $availableLevels = array_flip(Logger::getLevels());
     if (!isset($availableLevels[$level])) {
         throw new InvalidLoggerLevelException(sprintf('The level: "%d" does not exist. The available levels are: "%s"', $level, implode(', ', array_keys($availableLevels))), 400);
     }
     $this->level = $level;
     return $this;
 }
 public function logLevelProvider()
 {
     $levels = array();
     $monologLogger = new Logger('');
     foreach ($monologLogger->getLevels() as $levelName => $level) {
         $levels[] = array($levelName, $level);
     }
     return $levels;
 }
 /**
  * Calls the named method which is not a class method.
  *
  * This method will check whether PSR-3 or Yii2 format is used and will execute the corresponding method.
  *
  * @param string $name The method name.
  * @param array $arguments Method arguments.
  *
  * @return mixed The method return value.
  */
 public function __call($name, array $arguments)
 {
     // Intercept calls to the "log()" method
     if ($name === 'log' && !empty($arguments)) {
         // PSR-3 format
         $reflection = new ReflectionClass(YiiLogger::className());
         if (in_array($arguments[0], array_keys($this->_monolog->getLevels())) && !in_array($arguments[1], array_keys($reflection->getConstants())) && (!isset($arguments[3]) || isset($arguments[3]) && is_array($arguments[3]))) {
             return call_user_func_array([$this, 'log'], $arguments);
         }
         // Yii2 format
         return call_user_func_array([$this, 'yiiLog'], $arguments);
     }
     // Execute Monolog methods, if they exists
     if (method_exists($this->_monolog, $name) && !method_exists($this, $name)) {
         return call_user_func_array([$this->_monolog, $name], $arguments);
     }
     return parent::__call($name, $arguments);
 }
 public function testSetColorSchemeFilter()
 {
     $dummyArray = array(Logger::DEBUG => $this->ansi->sgr(array(SGR::COLOR_FG_GREEN, SGR::STYLE_INTENSITY_FAINT))->get(), '123' => 'foo', 9000 => 'bar', Logger::INFO => $this->ansi->sgr(array(SGR::COLOR_FG_GREEN, SGR::STYLE_INTENSITY_NORMAL))->get(), Logger::NOTICE => $this->ansi->sgr(array(SGR::COLOR_FG_GREEN, SGR::STYLE_INTENSITY_BRIGHT))->get(), 'foo' => 200, Logger::WARNING => $this->ansi->sgr(array(SGR::COLOR_FG_YELLOW, SGR::STYLE_INTENSITY_FAINT))->get(), Logger::ERROR => $this->ansi->sgr(array(SGR::COLOR_FG_YELLOW, SGR::STYLE_INTENSITY_NORMAL))->get(), Logger::CRITICAL => $this->ansi->sgr(array(SGR::COLOR_FG_RED, SGR::STYLE_INTENSITY_NORMAL))->get(), Logger::ALERT => $this->ansi->sgr(array(SGR::COLOR_FG_RED_BRIGHT, SGR::STYLE_INTENSITY_BRIGHT))->get(), Logger::EMERGENCY => $this->ansi->sgr(array(SGR::COLOR_FG_RED_BRIGHT, SGR::STYLE_INTENSITY_BRIGHT, SGR::STYLE_BLINK))->get());
     $this->clf->getColorScheme()->setColorizeArray($dummyArray);
     foreach (Logger::getLevels() as $level) {
         $this->assertArrayHasKey($level, $this->clf->getColorScheme()->getColorizeArray());
     }
     $this->assertArrayNotHasKey('123', $this->clf->getColorScheme()->getColorizeArray());
     $this->assertArrayNotHasKey('foo', $this->clf->getColorScheme()->getColorizeArray());
     $this->assertArrayNotHasKey(9000, $this->clf->getColorScheme()->getColorizeArray());
 }
Exemple #16
0
 /**
  * @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided
  * @param int       $maxLevel       Maximum level to accept, only used if $minLevelOrList is not an array
  */
 public function setAcceptedLevels($minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY)
 {
     if (is_array($minLevelOrList)) {
         $acceptedLevels = $minLevelOrList;
     } else {
         $acceptedLevels = array_filter(Logger::getLevels(), function ($level) use($minLevelOrList, $maxLevel) {
             return $level >= $minLevelOrList && $level <= $maxLevel;
         });
     }
     $this->acceptedLevels = array_flip($acceptedLevels);
 }
 public static function translateLevel($name)
 {
     if (is_int($name)) {
         return $name;
     }
     $levels = Logger::getLevels();
     $upper = strtoupper($name);
     if (!isset($levels[$upper])) {
         throw new \InvalidArgumentException("Provided logging level '{$name}' does not exist. Must be a valid monolog logging level.");
     }
     return $levels[$upper];
 }
 /**
  *
  * @param int|array $minLevelOrList
  *        	A list of levels to accept or a minimum level if maxLevel is provided
  * @param int $maxLevel
  *        	Maximum level to accept, only used if $minLevelOrList is not an array
  */
 public function setAcceptedLevels($minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY)
 {
     if (is_array($minLevelOrList)) {
         $acceptedLevels = array_map('Monolog\\Logger::toMonologLevel', $minLevelOrList);
     } else {
         $minLevelOrList = Logger::toMonologLevel($minLevelOrList);
         $maxLevel = Logger::toMonologLevel($maxLevel);
         $acceptedLevels = array_values(array_filter(Logger::getLevels(), function ($level) use($minLevelOrList, $maxLevel) {
             return $level >= $minLevelOrList && $level <= $maxLevel;
         }));
     }
     $this->acceptedLevels = array_flip($acceptedLevels);
 }
 public function parseLevel($name)
 {
     // level is already translated to logger constant, return as-is
     if (is_int($name)) {
         return $name;
     }
     $levels = Logger::getLevels();
     $upper = strtoupper($name);
     if (!isset($levels[$upper])) {
         throw new \InvalidArgumentException("Provided logging level '{$name}' does not exist. Must be a valid monolog logging level.");
     }
     return $levels[$upper];
 }
 public function log($message, $priority = self::INFO)
 {
     if (!is_array($message) && method_exists($this, 'logException')) {
         // forward BC with Nette in 2.3-dev
         $exceptionFile = $message instanceof \Exception ? $this->logException($message) : NULL;
         $message = array(@date('[Y-m-d H-i-s]'), $this->formatMessage($message), ' @ ' . self::getSource(), $exceptionFile ? ' @@ ' . basename($exceptionFile) : NULL);
         if (in_array($priority, array(self::ERROR, self::EXCEPTION, self::CRITICAL), TRUE)) {
             $this->sendEmail(implode('', $message));
         }
     }
     $normalised = $message;
     $context = array('at' => self::getSource());
     if (is_array($message)) {
         // bc with Nette until 2.3
         if (count($message) >= 2 && preg_match('~\\[[\\d+ -]+\\]~i', $message[0])) {
             array_shift($message);
             // first entry is probably time
         }
         if (isset($message[1]) && preg_match('~\\@\\s+https?:\\/\\/.+~', $message[1]) || preg_match('~CLI:.+~i', $message[1])) {
             $context['at'] = ltrim($message[1], '@ ');
             unset($message[1]);
         }
         if (isset($message[2]) && preg_match('~\\@\\@\\s+exception\\-[^\\s]+\\.html~', $message[2])) {
             $context['tracy'] = ltrim($message[2], '@ ');
             unset($message[2]);
         }
         $normalised = implode($message);
     }
     $levels = $this->monolog->getLevels();
     $level = isset($levels[$uPriority = strtoupper($priority)]) ? $levels[$uPriority] : Monolog\Logger::INFO;
     switch ($priority) {
         case 'access':
             $this->monolog->addInfo($normalised, array('priority' => $priority) + $context);
             break;
         default:
             $this->monolog->addRecord($level, $normalised, array('priority' => $priority) + $context);
     }
     return isset($context['tracy']) ? $context['tracy'] : '';
 }
 public function __invoke($record)
 {
     if (isset($record['context']['channel'])) {
         $record['channel'] = $record['context']['channel'];
         unset($record['context']['channel']);
     } elseif (isset($record['context']['priority'])) {
         $rename = strtoupper($record['context']['priority']);
         if (!in_array($rename, array_keys(Logger::getLevels()), TRUE)) {
             $record['channel'] = strtolower($rename);
         }
         unset($record['context']['priority']);
     }
     return $record;
 }
Exemple #22
0
 public function __construct($channel, $level, $message, $context = [])
 {
     $this->channel = substr(str_slug($channel), 0, 10);
     if (strlen($this->channel) == 0) {
         throw new InvalidArgumentException('Channel name must be set');
     }
     $this->level = strtoupper($level);
     if (!isset(MonologLogger::getLevels()[$this->level])) {
         throw new InvalidArgumentException('Level must be a standard Monolog level');
     }
     $this->code = MonologLogger::getLevels()[$this->level];
     if (empty($message)) {
         throw new InvalidArgumentException('Log entry must contain a message');
     }
     $this->message = $message;
     $this->context = $context;
 }
 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);
     });
 }
Exemple #24
0
 /**
  * @param string            $serviceId The name of the service within the container
  * @param string            $name      The job type
  * @param callback|callable $callable  The callable associated with the type
  * @param int|null          $logLevel  The Monolog\Logger log level
  */
 function __construct($serviceId, $name, $callable, $logLevel = null)
 {
     if (!is_string($name) || strlen((string) $name) == 0) {
         throw new \InvalidArgumentException('$type must be a string');
     }
     if (!is_callable($callable)) {
         throw new \InvalidArgumentException(sprintf('The callable defined for type "%s" is not callable', $name));
     }
     if ($logLevel !== null && !is_int($logLevel)) {
         throw new \InvalidArgumentException('$logLevel must be an integer value');
     }
     if ($logLevel !== null && !in_array($logLevel, Logger::getLevels())) {
         throw new \InvalidArgumentException('$logLevel must be valid Monolog\\Logger log level');
     }
     $this->serviceId = $serviceId;
     $this->name = $name;
     $this->callable = $callable;
     $this->logLevel = $logLevel;
     $this->class = !is_array($this->callable) ? null : get_class($this->callable[0]);
     $this->method = !is_array($this->callable) ? null : $this->callable[1];
 }
Exemple #25
0
 public static function getLevels()
 {
     return Logger::getLevels();
 }
 /**
  * Gets all supported logging levels.
  *
  * @return array Assoc array with human-readable level names => level codes.
  * @static 
  */
 public static function getLevels()
 {
     return \Monolog\Logger::getLevels();
 }
 protected function setUp()
 {
     parent::setUp();
     $this->eventDispatcher = new EventDispatcher();
     $this->conn = static::createConnection('bpm_', $this->eventDispatcher);
     static::migrateDirectoryUp($this->conn, __DIR__ . '/../../migration');
     $logger = NULL;
     if (NULL !== ($logLevel = $this->getLogLevel())) {
         $stderr = fopen('php://stderr', 'wb');
         $levels = array_change_key_case(Logger::getLevels(), CASE_UPPER);
         $logger = new Logger('BPMN');
         $logger->pushHandler(new StreamHandler($stderr, $levels[strtoupper($logLevel)]));
         $logger->pushProcessor(new PsrLogMessageProcessor());
         fwrite($stderr, "\n");
         fwrite($stderr, sprintf("TEST CASE: %s\n", $this->getName()));
         // 			$this->conn$conn->setDebug(true);
         // 			$this->conn->setLogger($logger);
     }
     $this->messageHandlers = [];
     $this->serviceTaskHandlers = [];
     // Provide message handler subscriptions.
     $this->eventDispatcher->connect(function (MessageThrownEvent $event) {
         $def = $this->repositoryService->createProcessDefinitionQuery()->processDefinitionId($event->execution->getProcessDefinitionId())->findOne();
         $key = $def->getKey();
         $id = $event->execution->getActivityId();
         if (isset($this->messageHandlers[$key][$id])) {
             return $this->messageHandlers[$key][$id]($event);
         }
     });
     $this->eventDispatcher->connect(function (TaskExecutedEvent $event) {
         $execution = $this->runtimeService->createExecutionQuery()->executionId($event->execution->getExecutionId())->findOne();
         $key = $execution->getProcessDefinition()->getKey();
         $id = $event->execution->getActivityId();
         if (isset($this->serviceTaskHandlers[$key][$id])) {
             $this->serviceTaskHandlers[$key][$id]($event->execution);
         }
     });
     // Allow for assertions in expressions, e.g. #{ @test.assertEquals(2, processVariable) }
     $this->eventDispatcher->connect(function (CreateExpressionContextEvent $event) {
         $event->access->setVariable('@test', $this);
     });
     $this->delegateTasks = new DelegateTaskRegistry();
     $this->processEngine = new ProcessEngine($this->conn, $this->eventDispatcher, new ExpressionContextFactory());
     $this->processEngine->setDelegateTaskFactory($this->delegateTasks);
     $this->processEngine->setLogger($logger);
     $scheduler = new TestJobScheduler($this->processEngine);
     $this->jobExecutor = new JobExecutor($this->processEngine, $scheduler);
     $this->processEngine->setJobExecutor($this->jobExecutor);
     $this->repositoryService = $this->processEngine->getRepositoryService();
     $this->runtimeService = $this->processEngine->getRuntimeService();
     $this->taskService = $this->processEngine->getTaskService();
     $this->historyService = $this->processEngine->getHistoryService();
     $this->managementService = $this->processEngine->getManagementService();
     if ($this->typeInfo === NULL) {
         $this->typeInfo = new ReflectionTypeInfo(new \ReflectionClass(get_class($this)));
     }
     foreach ($this->typeInfo->getMethods() as $method) {
         if (!$method->isPublic() || $method->isStatic()) {
             continue;
         }
         foreach ($method->getAnnotations() as $anno) {
             if ($anno instanceof MessageHandler) {
                 $this->messageHandlers[$anno->processKey][$anno->value] = [$this, $method->getName()];
             }
             if ($anno instanceof ServiceTaskHandler) {
                 $this->serviceTaskHandlers[$anno->processKey][$anno->value] = [$this, $method->getName()];
             }
         }
     }
 }
Exemple #28
0
 public function initLogger()
 {
     $file = __DIR__ . '/../../app/log/site.log';
     $this->register(new \Silex\Provider\MonologServiceProvider(), array('monolog.logfile' => $file));
     $levels = Logger::getLevels();
     $this['monolog'] = $this->share($this->extend('monolog', function ($monolog, $this) use($levels, $file) {
         $RotateHandler = new RotatingFileHandler($file, $this['config']['log']['max_files'], $this['config']['log']['log_level']);
         $RotateHandler->setFilenameFormat($this['config']['log']['prefix'] . '{date}' . $this['config']['log']['suffix'], $this['config']['log']['format']);
         $FingerCrossedHandler = new FingersCrossedHandler($RotateHandler, new ErrorLevelActivationStrategy($levels[$this['config']['log']['action_level']]));
         $monolog->popHandler();
         $monolog->pushHandler($FingerCrossedHandler);
         return $monolog;
     }));
 }
Exemple #29
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;
 }
 /**
  * The loglevel may be changed after the log handlers are initialised. If this is the case, this function will
  * update the handlers and note the chance in the log
  *
  * @param int $logLevel
  *
  * @return RuntimeConfig
  * @throws BaseCommandException
  */
 public function setLogLevel($logLevel)
 {
     if (!in_array($logLevel, Logger::getLevels())) {
         $message = "'" . $logLevel . "' is not a valid LOGLEVEL. " . "Valid values as command line parameters are: " . implode(',', array_keys(Logger::getLevels())) . " and valid values when updating the log level in code are: " . implode(',', Logger::getLevels());
         throw new BaseCommandException($message);
     }
     $this->logLevel = $logLevel;
     if ($this->getExecutionPhase() == self::PHASE_LOAD_PARAMETERS) {
         // LogLevel changed at RunTime via parameter
         $this->logConfigDebug('LOG LEVEL CHANGED VIA PARAMETER: ' . Logger::getLevelName($logLevel));
     } elseif ($this->getExecutionPhase() >= self::PHASE_INITIALISE) {
         // LogLevel changed  after the log handlers have been initialised
         /* @var $handler AbstractHandler */
         foreach ($this->getCommand()->getLogger()->getHandlers() as $handler) {
             $handler->setLevel($logLevel);
         }
         // Note in log that log level has been changed so that the new verbosity in the log is understood
         $this->logConfigDebug('LOG LEVEL CHANGED: ' . Logger::getLevelName($logLevel));
     }
     return $this;
 }