示例#1
0
 public static function createChannel($channel, AbstractHandler $handler = null)
 {
     $cli_handler = new CliHandler();
     $cli_handler->setFormatter(new LineFormatter(CliHandler::LINE_FORMAT));
     $channel_handler = parent::createChannel($channel, $handler);
     $channel_handler->pushHandler($cli_handler);
     static::setChannel($channel, $channel_handler);
     return $channel_handler;
 }
示例#2
0
 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;
 }