當前位置: 首頁>>代碼示例>>PHP>>正文


PHP StreamHandler::pushProcessor方法代碼示例

本文整理匯總了PHP中Monolog\Handler\StreamHandler::pushProcessor方法的典型用法代碼示例。如果您正苦於以下問題:PHP StreamHandler::pushProcessor方法的具體用法?PHP StreamHandler::pushProcessor怎麽用?PHP StreamHandler::pushProcessor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Monolog\Handler\StreamHandler的用法示例。


在下文中一共展示了StreamHandler::pushProcessor方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: boot

 /**
  * @inheritDoc
  */
 public function boot()
 {
     // todo: implement multi-channel configuration.
     $this->container->bindFactory(LoggerInterface::class, function (Config $config) {
         $handler = new StreamHandler($this->kernel->getRootPath() . '/storage/logs/venta.log', $config->log_level ?? Logger::DEBUG);
         $handler->pushProcessor(new PsrLogMessageProcessor());
         if (!$this->kernel->isCli()) {
             $handler->pushProcessor(new WebProcessor(null, ['url' => 'REQUEST_URI', 'ip' => 'REMOTE_ADDR', 'http_method' => 'REQUEST_METHOD', 'server' => 'SERVER_NAME', 'referrer' => 'HTTP_REFERER', 'user_agent' => 'HTTP_USER_AGENT']));
         }
         $logger = new Logger('venta');
         $logger->pushHandler($handler);
         return $logger;
     }, true);
 }
開發者ID:venta,項目名稱:framework,代碼行數:17,代碼來源:Logging.php

示例2: setUpFileLogs

 /**
  * @param Container $container
  *
  * @return void
  *
  * @SuppressWarnings(PHPMD.ElseExpression)
  */
 protected static function setUpFileLogs(Container $container)
 {
     $container[LoggerInterface::class] = function (Container $container) {
         $appConfig = $container->get(ConfigInterface::class)->getConfig(C::class);
         $monolog = new Logger($appConfig[C::KEY_NAME]);
         if ($appConfig[C::KEY_IS_LOG_ENABLED] === true) {
             $handler = new StreamHandler($appConfig[C::KEY_LOG_PATH], $appConfig[C::KEY_LOG_LEVEL]);
             $handler->setFormatter(new LineFormatter(null, null, true, true));
             $handler->pushProcessor(new WebProcessor());
             $handler->pushProcessor(new UidProcessor());
         } else {
             $handler = new NullHandler();
         }
         $monolog->pushHandler($handler);
         return $monolog;
     };
 }
開發者ID:limoncello-php,項目名稱:app,代碼行數:24,代碼來源:SetUpLogs.php

示例3: getStreamHandlers

 /**
  * @param $logFolder
  *
  * @return StreamHandler[]
  */
 protected function getStreamHandlers($logFolder)
 {
     // create Monolog file stream
     $stream = new StreamHandler($logFolder . DIRECTORY_SEPARATOR . $this->getLogfileName());
     $stream->pushProcessor(array($this, 'streamProcessor'));
     $stream->setFormatter(new JSONFormatter());
     return [$stream];
 }
開發者ID:gavincsch,項目名稱:jsonlogger,代碼行數:13,代碼來源:Loggable.php

示例4: _initLogger

 /**
  * Initialise the logger
  *
  * By default a log is saved to file into the @home/log folder and
  * the log messages are stored by DeploYiiLogHandler to be used later.
  */
 private static function _initLogger()
 {
     $logDir = Shell::getHomeDir() . DIRECTORY_SEPARATOR . 'log';
     self::$logFile = $logDir . DIRECTORY_SEPARATOR . date('Ymd_His') . uniqid() . '.log';
     if (!is_dir($logDir)) {
         FileHelper::createDirectory($logDir);
     }
     self::$_logger = new Logger('main');
     $streamHandler = new StreamHandler(self::$logFile, Logger::DEBUG);
     /** @noinspection PhpParamsInspection */
     $streamHandler->pushProcessor(new PsrLogMessageProcessor());
     self::$deployiiHandler = new DeploYiiLogHandler();
     /** @noinspection PhpParamsInspection */
     self::$deployiiHandler->pushProcessor(new PsrLogMessageProcessor());
     self::$_logger->pushHandler($streamHandler);
     self::$_logger->pushHandler(self::$deployiiHandler);
 }
開發者ID:giovdk21,項目名稱:deployii,代碼行數:23,代碼來源:Log.php

示例5: register

 public function register(Application $app)
 {
     $app['monolog.formatter'] = $app->share(function () {
         return new LineFormatter(null, 'Y-m-d H:i:s.u');
     });
     $app['monolog.handler'] = function () use($app) {
         if (!$app['monolog.logfile']) {
             return new NullHandler();
         }
         if (method_exists('Silex\\Provider\\MonologServiceProvider', 'translateLevel')) {
             $level = MonologServiceProvider::translateLevel($app['monolog.level']);
         } else {
             $level = $app['monolog.level'];
         }
         $streamHandler = new StreamHandler($app['monolog.logfile'], $level);
         $streamHandler->setFormatter($app['monolog.formatter']);
         return $streamHandler;
     };
     $app['logger'] = $app->share($app->extend('logger', function (Logger $logger, \Pimple $app) {
         $logger->pushProcessor($app['logger.request_processor']);
         $logger->pushProcessor(new PsrLogMessageProcessor());
         if (!($app->offsetExists('monolog.logstashfile') && $app['monolog.logstashfile'])) {
             return $logger;
         }
         $logstashHandler = new StreamHandler($app['monolog.logstashfile'], $app['monolog.level']);
         $logstashHandler->setFormatter(new LogstashFormatter($app['monolog.name']));
         $extras = array();
         if ($app->offsetExists('meta.service')) {
             $extras['service'] = $app['meta.service'];
         }
         if ($app->offsetExists('meta.customer')) {
             $extras['customer'] = $app['meta.customer'];
         }
         if ($app->offsetExists('meta.environment')) {
             $extras['environment'] = $app['meta.environment'];
         }
         $logstashHandler->pushProcessor(new ExtraContextProcessor($extras));
         $logger->pushHandler($logstashHandler);
         return $logger;
     }));
     $app['logger.request_processor'] = $app->share(function () use($app) {
         return new RequestProcessor($app);
     });
 }
開發者ID:aptoma,項目名稱:silex-extras,代碼行數:44,代碼來源:ExtendedLoggerServiceProvider.php

示例6: getDefaultHandlers

 public static function getDefaultHandlers()
 {
     if (static::$default_handlers === null) {
         static::$default_handlers = array();
         $log_path = Config::get('wave')->path->logs;
         $log_path .= Config::get('wave')->logger->file->file;
         $log_dir = dirname($log_path);
         if (!is_writable($log_dir)) {
             @mkdir($log_dir, 0770, true);
         }
         $stream_handler = new StreamHandler($log_path, static::getDefaultLevel());
         $stream_handler->pushProcessor(new ExceptionIntrospectionProcessor());
         static::pushDefaultHandler($stream_handler);
         if (PHP_SAPI === 'cli') {
             $cli_handler = new CliHandler(Config::get('wave')->logger->cli->level);
             $cli_handler->setFormatter(new LineFormatter(CliHandler::LINE_FORMAT));
             static::pushDefaultHandler($cli_handler);
         }
     }
     return static::$default_handlers;
 }
開發者ID:wave-framework,項目名稱:wave,代碼行數:21,代碼來源:Log.php

示例7: pushProcessor

 public function pushProcessor($callback)
 {
     return $this->streamHandler->pushProcessor($callback);
 }
開發者ID:surfnet,項目名稱:stepup-bundle,代碼行數:4,代碼來源:PrimaryLogHandler.php


注:本文中的Monolog\Handler\StreamHandler::pushProcessor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。