/** * 追加日志到日志缓存 * * @param string $msg * @param int $type */ static function log($msg, $type = self::DEBUG) { // 如果是command,则用echo 替换 ljzhou 2015-1-28 if (!isset($_SERVER['SERVER_NAME'])) { echo date('c') . " " . $msg . "\n"; return; } static $instance; if (is_null($instance)) { $instance = new CloverLogger(); # 对象属性设置 $instance->_log_writer_dir = CloverLogger::$log_dir; //$log_dir;//ROOT_PATH. 'admin/filelock'; $instance->_log_cache_chunk_size = 64; $instance->_log_writer_filename = 'devel-' . date('ymd') . '.log'; $instance->_log_priorities = 'EMERG, ALERT, CRIT, ERR, WARN, NOTICE, INFO, DEBUG'; } $instance->append($msg, $type); }
public static function getLogger() { if (!Clover::$logger) { $instance = new CloverLogger(); $instance->setLogDir(Clover::$log_dir); Clover::$logger = $instance; } return Clover::$logger; }