Пример #1
0
 function __construct($name, $level, $pathname, $lineno, $msg, $args, $exc_info, $func = null)
 {
     $ct = microtime(true);
     $this->name = $name;
     $this->msg = $msg;
     $this->args = $args;
     $this->levelname = Logger::getLevelName($level);
     $this->levelno = $level;
     $this->pathname = $pathname;
     $this->filename = basename($pathname);
     $this->exc_info = $exc_info;
     $this->exc_text = null;
     $this->lineno = $lineno;
     $this->funcName = $func;
     $this->created = (int) $ct;
     $this->msecs = ($ct - $this->created) * 1000;
     $this->relativeCreated = ($this->created - static::$_startTime) * 1000;
 }
Пример #2
0
            $fmt = new Formatter($fs, $dfs);
            $hdlr->setFormatter($fmt);
            Log::$root->addHandler($hdlr);
            $level = @$config['level'];
            if (isset($level)) {
                Log::$root->setLevel($level);
            }
        }
    }
    static function getLogger($name = null)
    {
        if ($name) {
            return Logger::$manager->getLogger($name);
        } else {
            return static::$root;
        }
    }
    static function critical($msg, $context = array())
    {
        if (count(static::$root->handlers) == 0) {
            static::basicConfig();
        }
        Log::$root->critical($msg, $context);
    }
}
// This is the main file to be included when setting up the logging system.
// Setup the basic pieces
Log::$root = new RootLogger(Logger::WARNING);
Logger::$root = Log::$root;
Logger::$manager = new Manager(Logger::$root);
Manager::$loggerClass = __NAMESPACE__ . '\\Logger';
Пример #3
0
 function setLevel($level)
 {
     $this->level = Logger::_checkLevel($level);
 }
Пример #4
0
 function __construct($level)
 {
     parent::__construct("root", $level);
 }