當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。