Пример #1
0
 {
     if (empty(self::$log)) {
         return;
     }
     if (empty($destination)) {
         $destination = C('LOG_PATH') . date('y_m_d') . '.log';
     }
     if (!self::$storage) {
         $type = $type ?: C('LOG_TYPE');
         $class = 'Think\\Log\\Driver\\' . ucwords($type);
         self::$storage = new $class();
     }
     $message = implode('', self::$log);
Пример #2
0
 static function mySave($message, $level = self::ERR, \Exception $e)
 {
     $message .= "\r\n";
     $locationInfo = array();
     if ($e) {
         $trace = $e->getTrace();
         $message .= $e->getMessage() . "\r\n";
     } else {
         $trace = debug_backtrace();
     }
     if (is_array($trace)) {
         foreach ($trace as $k => $val) {
             $message .= "File:{$val["file"]}({$val['line']})  {$val['function']}  \r\n";
         }
     }
     if (!self::$storage) {
         $type = $type ?: C('LOG_TYPE');
         $class = 'Think\\Log\\Driver\\' . ucwords($type);
         self::$storage = new $class();
     }
     $destination = C('LOG_PATH') . date('y_m_d') . '.log';
     self::$storage->write("{$level}: {$message}", $destination);
 }