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


PHP Logger::logger方法代码示例

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


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

示例1: __construct

 private function __construct()
 {
     // setup file error logging
     $file_writer = new Logger_Errorlog();
     if (Config::get_optional("DEBUG_LOG") == false) {
         $file_writer->addFilter(Zend_Log::INFO);
     }
     $log = new Zend_Log();
     $log->addWriter($file_writer);
     // setup email error logging
     if (Config::get_optional("log_to_email") == true) {
         $mail = new Zend_Mail();
         $mail->setFrom(Config::get_mandatory('log_email_from'));
         $mail->addTo(Config::get_mandatory('log_email_to'));
         // setup email template
         $layout = new Zend_Layout();
         $layout->setLayoutPath(DOCUMENT_ROOT . Config::get_mandatory("log_email_template"));
         $layout->setLayout('error-logger');
         $layout_formatter = new Zend_Log_Formatter_Simple('<li>.' . Zend_Log_Formatter_Simple::DEFAULT_FORMAT . '</li>');
         // Use default HTML layout.
         $email_writer = new Zend_Log_Writer_Mail($mail, $layout);
         $email_writer->setLayoutFormatter($layout_formatter);
         $email_writer->setSubjectPrependText(Config::get_mandatory('log_email_subject_prepend'));
         $email_writer->addFilter(Zend_Log::ERR);
         $log->addWriter($email_writer);
     }
     self::$logger = $log;
 }
开发者ID:ThibautLeger,项目名称:123-mini,代码行数:28,代码来源:Logger.php

示例2: addLogger

 public static function addLogger($logger, $reset = false)
 {
     if ($reset) {
         self::$logger = array();
     }
     self::$logger[] = $logger;
     self::$enabled = true;
 }
开发者ID:pawansgi92,项目名称:pimcore2,代码行数:8,代码来源:Logger.php

示例3: L

 public static function L($logpath = '', $clear = false)
 {
     if (self::$logger === null) {
         self::$logger = new Logger($logpath, $clear);
     }
     self::$logger->setClear($clear);
     return self::$logger;
 }
开发者ID:stden,项目名称:cs-javaphp,代码行数:8,代码来源:logger.php

示例4: addLogger

 public static function addLogger($logger, $reset = false)
 {
     if ($reset) {
         self::$logger = array();
     }
     self::$logger[] = $logger;
     self::$dummyMode = false;
 }
开发者ID:nblackman,项目名称:pimcore,代码行数:8,代码来源:Logger.php

示例5:

 static function __callStatic($name, $args)
 {
     if (!self::$logger) {
         self::$logger = new Monolog\Logger('debug');
         self::$logger->pushHandler(new Monolog\Handler\StreamHandler(__DIR__ . '/../log/debug.log'));
     }
     return call_user_func_array([self::$logger, $name], $args);
 }
开发者ID:dthtvwls,项目名称:padscraper,代码行数:8,代码来源:Logger.php

示例6: addLogger

 /**
  * @param $logger
  * @param bool|false $reset
  * @throws Exception
  */
 public static function addLogger($logger, $reset = false)
 {
     if (!$logger instanceof \Zend_Log && !$logger instanceof \Psr\Log\LoggerInterface) {
         throw new \Exception("Logger must be either an instance of Zend_Log or needs to implement Psr\\Log\\LoggerInterface");
     }
     if ($reset) {
         self::$logger = array();
     }
     self::$logger[] = $logger;
     self::$enabled = true;
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:16,代码来源:Logger.php

示例7: getLogger

 /**
  * Retrieve the singleton logger instance, creating it if necessary.
  *
  * @return Returns the logger.
  */
 public static function getLogger()
 {
     // Make sure the logger has been created.
     if (self::$logger === null) {
         // Define the logging format.
         $format = '%timestamp% %priorityName% %message%' . PHP_EOL;
         // Create the formatter.
         $formatter = new Zend_Log_Formatter_Simple($format);
         // Create the new writer for the log file.
         $writer = new Zend_Log_Writer_Stream(Bootstrap::$root . '/logs/app.log');
         // Set the writer format.
         $writer->setFormatter($formatter);
         // Create the logger.
         self::$logger = new Zend_Log($writer);
     }
     // Return the logger.
     return self::$logger;
 }
开发者ID:mtday,项目名称:timesheet-system,代码行数:23,代码来源:Logger.php


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