当前位置: 首页>>代码示例>>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;未经允许,请勿转载。