Example #1
0
 public static function info($type, $params = array())
 {
     $t = \date("Ymd");
     $logPath = Config::getField('project', 'log_path', '');
     if (empty($logPath)) {
         $dir = ZPHP::getRootPath() . DS . 'log' . DS . $t;
     } else {
         $dir = $logPath . DS . $t;
     }
     Dir::make($dir);
     $str = \date('Y-m-d H:i:s', Config::get('now_time', time())) . self::SEPARATOR . \implode(self::SEPARATOR, array_map('ZPHP\\Common\\Log::myJson', $params));
     $logFile = $dir . \DS . $type . '.log';
     \file_put_contents($logFile, $str . "\n", FILE_APPEND | LOCK_EX);
 }
Example #2
0
File: Log.php Project: xifat/zphp
 public static function info($type, $params = array())
 {
     $t = \date("Ymd");
     $logPath = Config::get('log_path', '');
     if (empty($logPath)) {
         $dir = ZPHP::getRootPath() . DS . 'log' . DS . $t;
     } else {
         $dir = $logPath . DS . $t;
     }
     Dir::make($dir);
     $str = \date('Y-m-d H:i:s', Config::get('now_time', time())) . self::SEPARATOR . \implode(self::SEPARATOR, array_map('json_encode', $params));
     $logFile = $dir . \DS . $type . '.log';
     \error_log($str . "\n", 3, $logFile);
 }