当前位置: 首页>>代码示例>>PHP>>正文


PHP Logger::toMonologLevel方法代码示例

本文整理汇总了PHP中Monolog\Logger::toMonologLevel方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::toMonologLevel方法的具体用法?PHP Logger::toMonologLevel怎么用?PHP Logger::toMonologLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Monolog\Logger的用法示例。


在下文中一共展示了Logger::toMonologLevel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($name = 'PHPUnit', $level = 'debug')
 {
     /**
      * Filter growl notifications and send only
      * - test failures ($handerLevel = Logger::NOTICE; see GrowlHandler constructor)
      * - summary of test suites (message "Results OK ...", or "Results KO ..."
      */
     $filters = array(function ($record, $handlerLevel) {
         if ($record['level'] > $handlerLevel) {
             return true;
         }
         return preg_match('/^Results/', $record['message']) === 1;
     });
     $stream = new RotatingFileHandler(__DIR__ . DIRECTORY_SEPARATOR . 'monologTestListener.log', 0, Logger::toMonologLevel($level));
     $stream->setFilenameFormat('{filename}-{date}', 'Ymd');
     $handlers = array($stream);
     try {
         // be notified only for test suites and test failures
         $growl = new GrowlHandler(array(), Logger::NOTICE);
         $handlers[] = new CallbackFilterHandler($growl, $filters);
     } catch (\Exception $e) {
         // Growl server is probably not started
         echo $e->getMessage(), PHP_EOL, PHP_EOL;
     }
     parent::__construct($name, $handlers);
 }
开发者ID:jclaveau,项目名称:phpunit-LoggerTestListener,代码行数:26,代码来源:bootstrap.monolog.php

示例2: __construct

 public function __construct($level = Logger::DEBUG, array $skipClassesPartials = array(), array $skipFunctions = array(), $skipStackFramesCount = 0)
 {
     $this->level = Logger::toMonologLevel($level);
     $this->skipClassesPartials = array_merge(array('Monolog\\'), $skipClassesPartials);
     $this->skipFunctions = array_merge($this->skipFunctions, $skipFunctions);
     $this->skipStackFramesCount = $skipStackFramesCount;
 }
开发者ID:ec-cube,项目名称:ec-cube,代码行数:7,代码来源:IntrospectionProcessor.php

示例3: __construct

 /**
  * @param HandlerInterface $handler            Handler.
  * @param string           $deduplicationStore The file/path where the deduplication log should be kept
  * @param int              $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes
  * @param int              $time               The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through
  * @param Boolean          $bubble             Whether the messages that are handled can bubble up the stack or not
  */
 public function __construct(HandlerInterface $handler, $deduplicationStore = null, $deduplicationLevel = Logger::ERROR, $time = 60, $bubble = true)
 {
     parent::__construct($handler, 0, Logger::DEBUG, $bubble, false);
     $this->deduplicationStore = $deduplicationStore === null ? sys_get_temp_dir() . '/monolog-dedup-' . substr(md5(__FILE__), 0, 20) . '.log' : $deduplicationStore;
     $this->deduplicationLevel = Logger::toMonologLevel($deduplicationLevel);
     $this->time = $time;
 }
开发者ID:jorjoh,项目名称:Varden,代码行数:14,代码来源:DeduplicationHandler.php

示例4: register

 public function register(Application $app)
 {
     // System log
     $app['logger.system'] = $app->share(function ($app) {
         $log = new Logger('logger.system');
         $log->pushHandler($app['monolog.handler']);
         $log->pushHandler(new SystemHandler($app, Logger::INFO));
         return $log;
     });
     // Changelog
     $app['logger.change'] = $app->share(function ($app) {
         $log = new Logger('logger.change');
         $log->pushHandler(new RecordChangeHandler($app));
         return $log;
     });
     // Firebug
     $app['logger.firebug'] = $app->share(function ($app) {
         $log = new Logger('logger.firebug');
         $handler = new FirePHPHandler();
         $handler->setFormatter(new WildfireFormatter());
         $log->pushHandler($handler);
         return $log;
     });
     // System log
     $app['logger.flash'] = $app->share(function ($app) {
         $log = new FlashLogger();
         return $log;
     });
     // Manager
     $app['logger.manager'] = $app->share(function ($app) {
         $changeRepository = $app['storage']->getRepository('Bolt\\Storage\\Entity\\LogChange');
         $systemRepository = $app['storage']->getRepository('Bolt\\Storage\\Entity\\LogSystem');
         $mgr = new Manager($app, $changeRepository, $systemRepository);
         return $mgr;
     });
     $app->register(new MonologServiceProvider(), ['monolog.name' => 'bolt']);
     $app['monolog.level'] = function ($app) {
         return Logger::toMonologLevel($app['config']->get('general/debuglog/level'));
     };
     $app['monolog.logfile'] = function ($app) {
         return $app['resources']->getPath('cache') . '/' . $app['config']->get('general/debuglog/filename');
     };
     $app['monolog.handler'] = $app->extend('monolog.handler', function ($handler, $app) {
         // If we're not debugging, just send to /dev/null
         if (!$app['config']->get('general/debuglog/enabled')) {
             return new NullHandler();
         }
         return $handler;
     });
     // If we're not debugging, just send to /dev/null
     if (!$app['config']->get('general/debuglog/enabled')) {
         $app['monolog.handler'] = function () {
             return new NullHandler();
         };
     }
     $app['logger.debug'] = function () use($app) {
         return $app['monolog'];
     };
 }
开发者ID:bolt,项目名称:bolt,代码行数:59,代码来源:LoggerServiceProvider.php

示例5: getLevel

 /**
  * Get log level.
  *
  * @return int
  *
  * @author Wuhsien Yu <wuhsienyu@gmail.com>
  *
  * @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;
 }
开发者ID:wuhsien,项目名称:log-level,代码行数:17,代码来源:LogLevelServiceProvider.php

示例6: testConvertPSR3ToMonologLevel

 /**
  * @covers Monolog\Logger::toMonologLevel
  */
 public function testConvertPSR3ToMonologLevel()
 {
     $this->assertEquals(Logger::toMonologLevel('debug'), 100);
     $this->assertEquals(Logger::toMonologLevel('info'), 200);
     $this->assertEquals(Logger::toMonologLevel('notice'), 250);
     $this->assertEquals(Logger::toMonologLevel('warning'), 300);
     $this->assertEquals(Logger::toMonologLevel('error'), 400);
     $this->assertEquals(Logger::toMonologLevel('critical'), 500);
     $this->assertEquals(Logger::toMonologLevel('alert'), 550);
     $this->assertEquals(Logger::toMonologLevel('emergency'), 600);
 }
开发者ID:saj696,项目名称:pipe,代码行数:14,代码来源:LoggerTest.php

示例7: factory

 public static function factory(array $config, array $handlers, $debug)
 {
     $config = self::validateAndNormaliseConfig($config);
     if (!isset($handlers[$config['handler']])) {
         throw new InvalidConfigurationException(sprintf("No handler with name '%s' defined. Did you define it before this handler?", $config['handler']));
     }
     if ($debug) {
         // When debug is enabled, do not buffer messages, but let them be handled our delegate handler.
         return $handlers[$config['handler']];
     }
     return new FingersCrossedHandler($handlers[$config['handler']], $config['activation_strategy']['factory']::factory($config['activation_strategy']['conf']), 0, true, true, Logger::toMonologLevel($config['passthru_level']));
 }
开发者ID:WebSpider,项目名称:OpenConext-engineblock,代码行数:12,代码来源:FingersCrossedHandlerFactory.php

示例8: __construct

 /**
  * @param string       $token             Pushover api token
  * @param string|array $users             Pushover user id or array of ids the message will be sent to
  * @param string       $title             Title sent to the Pushover API
  * @param integer      $level             The minimum logging level at which this handler will be triggered
  * @param Boolean      $bubble            Whether the messages that are handled can bubble up the stack or not
  * @param Boolean      $useSSL            Whether to connect via SSL. Required when pushing messages to users that are not
  *                                        the pushover.net app owner. OpenSSL is required for this option.
  * @param integer      $highPriorityLevel The minimum logging level at which this handler will start
  *                                        sending "high priority" requests to the Pushover API
  * @param integer      $emergencyLevel    The minimum logging level at which this handler will start
  *                                        sending "emergency" requests to the Pushover API
  * @param integer      $retry             The retry parameter specifies how often (in seconds) the Pushover servers will send the same notification to the user.
  * @param integer      $expire            The expire parameter specifies how many seconds your notification will continue to be retried for (every retry seconds).
  */
 public function __construct($token, $users, $title = null, $level = Logger::CRITICAL, $bubble = true, $useSSL = true, $highPriorityLevel = Logger::CRITICAL, $emergencyLevel = Logger::EMERGENCY, $retry = 30, $expire = 25200)
 {
     $connectionString = $useSSL ? 'ssl://api.pushover.net:443' : 'api.pushover.net:80';
     parent::__construct($connectionString, $level, $bubble);
     $this->token = $token;
     $this->users = (array) $users;
     $this->title = $title ?: gethostname();
     $this->highPriorityLevel = Logger::toMonologLevel($highPriorityLevel);
     $this->emergencyLevel = Logger::toMonologLevel($emergencyLevel);
     $this->retry = $retry;
     $this->expire = $expire;
 }
开发者ID:Ceciceciceci,项目名称:MySJSU-Class-Registration,代码行数:27,代码来源:PushoverHandler.php

示例9: load

 /**
  * {@inheritdoc}
  */
 public function load(array $configs, ContainerBuilder $container)
 {
     $configuration = new Configuration();
     $config = $this->processConfiguration($configuration, $configs);
     // Converts PSR-3 levels to Monolog ones if necessary
     $config['level'] = Logger::toMonologLevel($config['level']);
     $container->setParameter('ae_monolog_fluentd.host', $config['host']);
     $container->setParameter('ae_monolog_fluentd.port', $config['port']);
     $container->setParameter('ae_monolog_fluentd.options', $config['options']);
     $container->setParameter('ae_monolog_fluentd.level', $config['level']);
     $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
     $loader->load('services.xml');
 }
开发者ID:adespresso,项目名称:MonologFluentdBundle,代码行数:16,代码来源:AeMonologFluentdExtension.php

示例10: setAcceptedLevels

 /**
  *
  * @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);
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:20,代码来源:FilterHandler.php

示例11: register

 public function register(App $glue)
 {
     #if (!$glue->config->exists('monolog.path')) {
     #    // No log path set
     #    return;
     #}
     $glue->singleton('Monolog\\Logger', function ($glue) {
         $logLevel = $glue->config->get('monolog.level', Logger::ERROR);
         $logLevel = Logger::toMonologLevel($logLevel);
         $folder = $glue->config->get('monolog.folder');
         $filename = $glue->config->get('monolog.file', 'app.log');
         // create a log channel
         $log = new Logger($glue->config->get('monolog.name', 'glue'));
         $log->pushHandler(new StreamHandler($folder . '/' . $filename, $logLevel));
         return $log;
     });
     $glue->singleton('Psr\\Log\\LoggerInterface', 'Monolog\\Logger');
     $glue->alias('Monolog\\Logger', 'log');
 }
开发者ID:gluephp,项目名称:glue-monolog,代码行数:19,代码来源:ServiceProvider.php

示例12: __construct

 /**
  * @param callable|HandlerInterface       $handler            Handler or factory callable($record, $fingersCrossedHandler).
  * @param int|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action
  * @param int                             $bufferSize         How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
  * @param Boolean                         $bubble             Whether the messages that are handled can bubble up the stack or not
  * @param Boolean                         $stopBuffering      Whether the handler should stop buffering after being triggered (default true)
  * @param int                             $passthruLevel      Minimum level to always flush to handler on close, even if strategy not triggered
  */
 public function __construct($handler, $activationStrategy = null, $bufferSize = 0, $bubble = true, $stopBuffering = true, $passthruLevel = null)
 {
     if (null === $activationStrategy) {
         $activationStrategy = new ErrorLevelActivationStrategy(Logger::WARNING);
     }
     // convert simple int activationStrategy to an object
     if (!$activationStrategy instanceof ActivationStrategyInterface) {
         $activationStrategy = new ErrorLevelActivationStrategy($activationStrategy);
     }
     $this->handler = $handler;
     $this->activationStrategy = $activationStrategy;
     $this->bufferSize = $bufferSize;
     $this->bubble = $bubble;
     $this->stopBuffering = $stopBuffering;
     if ($passthruLevel !== null) {
         $this->passthruLevel = Logger::toMonologLevel($passthruLevel);
     }
     if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) {
         throw new \RuntimeException("The given handler (" . json_encode($this->handler) . ") is not a callable nor a Monolog\\Handler\\HandlerInterface object");
     }
 }
开发者ID:earncef,项目名称:monolog,代码行数:29,代码来源:FingersCrossedHandler.php

示例13: __construct

 public function __construct($actionLevel, array $ignore)
 {
     $this->actionLevel = \Monolog\Logger::toMonologLevel($actionLevel);
     $this->ignore = $ignore;
 }
开发者ID:marcoazn89,项目名称:monolog-ignore-strategy,代码行数:5,代码来源:IgnoreStrategy.php

示例14: __construct

 public function __construct($level = Logger::DEBUG, $backtraceLevel = 8)
 {
     $this->level = Logger::toMonologLevel($level);
     $this->backtraceLevel = $backtraceLevel;
 }
开发者ID:Victopia,项目名称:prefw,代码行数:5,代码来源:BacktraceProcessor.php

示例15: useRotatingFiles

 /**
  * 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;
 }
开发者ID:creasi,项目名称:slim-monolog,代码行数:14,代码来源:Monolog.php


注:本文中的Monolog\Logger::toMonologLevel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。