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


PHP Logger::__construct方法代码示例

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


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

示例1: __construct

 public function __construct($channel = self::CHANNEL_APPLICATION)
 {
     parent::__construct($channel);
     $this->addDatabaseHandler();
     $le = new Event($this);
     Events::dispatch('on_logger_create', $le);
 }
开发者ID:ngreimel,项目名称:kovent,代码行数:7,代码来源:Logger.php

示例2: __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

示例3: __construct

 public function __construct()
 {
     $logConfig = ApiConfig::getLogConfig();
     parent::__construct($logConfig['name']);
     parent::pushHandler(new RotatingFileHandler("{$logConfig['log_path']}/info-log"), Logger::INFO);
     parent::pushHandler(new RotatingFileHandler("{$logConfig['log_path']}/info-log"), Logger::ERROR);
 }
开发者ID:zgoubaophp,项目名称:boytemptapi,代码行数:7,代码来源:ApiLogger.php

示例4: __construct

 public function __construct($appname = "Tranquillity", $logprio = LOG_USER, $level = \Monolog\Logger::INFO)
 {
     parent::__construct($appname);
     $this->loghandler = new SyslogHandler($appname, $logprio, $level);
     $this->pushHandler($this->loghandler);
     $this->logformatter = new LineFormatter("[%level_name%] %message%");
     $this->loghandler->setFormatter($this->logformatter);
 }
开发者ID:dam2k,项目名称:tranquillity,代码行数:8,代码来源:Log.php

示例5: __construct

 public function __construct($channel = self::CHANNEL_APPLICATION, $logLevel = MonologLogger::DEBUG)
 {
     parent::__construct($channel);
     $this->addDatabaseHandler($logLevel);
     $this->pushProcessor(new PsrLogMessageProcessor());
     $le = new Event($this);
     Events::dispatch('on_logger_create', $le);
 }
开发者ID:digideskio,项目名称:concrete5,代码行数:8,代码来源:Logger.php

示例6: __construct

 /**
  * @param string $name The logging channel
  * @param MonologHandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc.
  * @param callable[] $processors Optional array of processors
  */
 public function __construct($name, array $handlers = [], array $processors = [])
 {
     /**
      * This is a fix for Pthreads, since that extension does not copy static variables accross threads
      */
     static::$levels = [self::DEBUG => 'DEBUG', self::INFO => 'INFO', self::NOTICE => 'NOTICE', self::WARNING => 'WARNING', self::ERROR => 'ERROR', self::CRITICAL => 'CRITICAL', self::ALERT => 'ALERT', self::EMERGENCY => 'EMERGENCY'];
     parent::__construct($name, $handlers, $processors);
 }
开发者ID:kraken-php,项目名称:framework,代码行数:13,代码来源:LoggerWrapper.php

示例7: array

 /**
  * @param string $name
  * @param array  $handlers
  * @param array  $processors
  */
 function __construct($name = 'main', array $handlers = array(), array $processors = array())
 {
     /* Create new logger */
     parent::__construct($name, $handlers, $processors);
     /* Add default, console handler */
     $handler = new \Monolog\Handler\StreamHandler('php://stderr', \Monolog\Logger::DEBUG);
     $handler->setFormatter(new \Monolog\Formatter\LineFormatter("[%datetime%] [%channel%.%level_name%] -- %message%\n"));
     $this->pushHandler($handler);
 }
开发者ID:kontoulis,项目名称:rabbit-manager,代码行数:14,代码来源:Logger.php

示例8: __construct

 public function __construct($name)
 {
     parent::__construct($name);
     $this->log = new StringBufferHandler(Logger::DEBUG);
     $this->log->setFormatter(new TaskLogFormatter());
     $this->pushHandler($this->log);
     $this->executionTime = new ExecutionTimeProcessor();
     $this->pushProcessor($this->executionTime);
 }
开发者ID:wackamole0,项目名称:rainmaker-tool,代码行数:9,代码来源:TaskLogger.php

示例9:

 /**
  * Builds Monolog\Logger data with set of handlers given in configuration file.
  * @param string $channelName Name of logging channel
  * @param Settings $settings object with json-formatted config
  * @throws InvalidArgumentException if $channelName is not a string
  * @todo check handler parameters compatibility
  */
 function __construct($channelName, Settings $settings)
 {
     if (!is_string($channelName)) {
         throw new \InvalidArgumentException('Channel name should be a string');
     }
     parent::__construct($channelName);
     $this->settings = $settings;
     $this->attachHandlers();
 }
开发者ID:eugenest,项目名称:monocfg,代码行数:16,代码来源:Logger.php

示例10: __construct

 public function __construct(Application $application, array $handlers = [], array $processors = [], Console $consoleHandler = null)
 {
     if ($application->isDebugMode()) {
         if (null === $consoleHandler) {
             $consoleHandler = new Console($application);
         }
         $handlers[] = $consoleHandler;
     }
     parent::__construct($application->getName(), $handlers, $processors);
     $this->setApplication($application)->setConsoleHandler($consoleHandler);
 }
开发者ID:panadas,项目名称:plugin-logger,代码行数:11,代码来源:Logger.php

示例11: __construct

 public function __construct()
 {
     parent::__construct("maestro");
     $conf = Manager::getConf('maestro.logs');
     $this->baseDir = $conf['path'];
     $this->level = $conf['level'];
     $this->handler = $conf['handler'];
     $this->port = $conf['port'];
     $this->peer = $conf['peer'];
     $this->strict = $conf['strict'];
     if (empty($this->host)) {
         $this->host = $_SERVER['REMOTE_ADDR'];
     }
 }
开发者ID:elymatos,项目名称:expressive,代码行数:14,代码来源:MLogger.php

示例12: __construct

 public function __construct($configSection)
 {
     self::factoryConstruct($configSection);
     $config = $this->getPackageConfig();
     parent::__construct($config['name']);
     $directory = dirname($config['path']);
     if (!file_exists($directory)) {
         $status = @mkdir($directory, 0777, true);
         if ($status === false) {
             $config['path'] = sys_get_temp_dir() . '/mpcmf.' . posix_getpid() . '.log';
             $this->addCritical("Log directory creation failed, use new path instead of original. New path: {$config['path']}");
         }
     } elseif (is_writable($directory)) {
         @chmod($directory, 0777);
     }
     $this->pushHandler(new StreamHandler($config['path'], $config['level']));
     MPCMF_DEBUG && $this->addDebug("New log created: {$this->configSection}");
 }
开发者ID:mpcmf,项目名称:mpcmf-core,代码行数:18,代码来源:log.php

示例13: __construct

 public function __construct($name = '', $debug = false)
 {
     $options = getopt("", ['debug']);
     if (isset($options['debug'])) {
         // Default format with all the info for dev debug
         $formatter = new LineFormatter();
         $debug = true;
     } elseif (!empty($debug)) {
         // Set user debug mode
         $formatter = new LineFormatter("%level_name%: %message% %context% %extra%\n");
     } else {
         // Simple message (TODO add user readable $context)
         $formatter = new LineFormatter("%message%\n");
     }
     $errHandler = new StreamHandler('php://stderr', \Monolog\Logger::NOTICE, false);
     $level = $debug ? \Monolog\Logger::DEBUG : \Monolog\Logger::INFO;
     $handler = new StreamHandler('php://stdout', $level);
     $handler->setFormatter($formatter);
     parent::__construct($name, [$errHandler, $handler]);
 }
开发者ID:keboola,项目名称:db-extractor-common,代码行数:20,代码来源:Logger.php

示例14: __construct

 /**
  * @param string             $name       The logging channel
  * @param HandlerInterface[] $handlers   Optional stack of handlers, the first one in the array is called first, etc.
  * @param callable[]         $processors Optional array of processors
  */
 public function __construct($name, array $handlers = array(), array $processors = array())
 {
     parent::__construct($name, $handlers, $processors);
     // set handler
     $elgg_log_level = _elgg_services()->logger->getLevel();
     if ($elgg_log_level == \Elgg\Logger::OFF) {
         // always log errors
         $elgg_log_level = \Elgg\Logger::ERROR;
     }
     $handler = new RotatingFileHandler(elgg_get_data_path() . 'elasticsearch/client.log', 0, $elgg_log_level);
     // create correct folder structure
     $date = date('Y/m/');
     $path = elgg_get_data_path() . "elasticsearch/{$date}";
     if (!is_dir($path)) {
         mkdir($path, 0755, true);
     }
     $handler->setFilenameFormat('{date}_{filename}', 'Y/m/d');
     $this->pushHandler($handler);
     // set logging processor
     $processor = new IntrospectionProcessor();
     $this->pushProcessor($processor);
 }
开发者ID:coldtrick,项目名称:elasticsearch,代码行数:27,代码来源:DatarootLogger.php

示例15: __construct

 /**
  * Console logger class constructor
  *
  * @param string $name  The logging channel
  * @param string $level The minimum logging level
  */
 public function __construct($name = 'YourLogger', $level = Logger::DEBUG)
 {
     $filterRules = array(function ($record) {
         if (!array_key_exists('operation', $record['context'])) {
             return false;
         }
         return 'printFooter' === $record['context']['operation'];
     });
     $stream = new RotatingFileHandler(__DIR__ . '/phpunit-growlhandler-php' . PHP_VERSION_ID . '.log', 30);
     $stream->setFilenameFormat('{filename}-{date}', 'Ymd');
     $console = new StreamHandler('php://stdout');
     $console->setFormatter(new LineFormatter("%message%\n", null, true));
     $filter = new FilterHandler($console);
     $handlers = array($filter, $stream);
     try {
         $options = array('resourceDir' => dirname(__DIR__) . '/vendor/pear-pear.php.net/Net_Growl/data/Net_Growl/data', 'defaultIcon' => '80/growl_phpunit.png');
         $growl = new GrowlHandler(array('name' => 'PHPUnit ResultPrinter', 'options' => $options), Logger::NOTICE);
         $growl->setFormatter(new LineFormatter("Growl for Monolog\n" . "%message%"));
         $handlers[] = new CallbackFilterHandler($growl, $filterRules);
     } catch (\Exception $e) {
         // Growl server is probably not started
     }
     parent::__construct($name, $handlers);
 }
开发者ID:ElectroLutz,项目名称:monolog-growlhandler,代码行数:30,代码来源:MonologConsoleLogger.php


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