记录日志
@param string $msg           日志内容
@param string $log_path     日志路径
491933
public function log($msg,$log_path = null)
    {
        $option = [
            'type' => 'File',
            'file_size' => 2097152,
            'time_format' => 'c',
        ];
        if ($log_path) {
            $option['path'] = WX_API_PATH.'/../../log/wx/';
        }else{
            $option['path'] = $log_path;
        }
        \think\Log::init($option);
        \think\Log::record($msg);
    }
511556
private function checkLogFile($path)
    {
        $status   = true;
        $filename = basename($path);
        $message  = "The log file [$filename] is valid.";

        if ($this->isSingleLogFile($filename)) {
            $this->status = $status  = false;
            $this->messages['files'][$filename] = $message =
                "You have a single log file in your application, you should split the [$filename] into separate log files.";
        }
        elseif ($this->isInvalidLogDate($filename)) {
            $this->status = $status  = false;
            $this->messages['files'][$filename] = $message =
                "The log file [$filename] has an invalid date, the format must be like laravel-YYYY-MM-DD.log.";
        }

        $this->files[$filename] = compact('filename', 'status', 'message', 'path');
    }
878005
final public function logError($msg_code,$data = array())
    {
        self::write(self::compileMessage(self::$error_msg[$msg_code],$data), PEL_ERROR);
    }
1019228
protected function log($level, $msg, $context = [])
    {
        $this->log[$level][] = $msg;
        \Log::log($level, $msg, $context);
    }
412667
public function record($msg, $type = 'info', array $context = [])
    {
        if (is_string($msg)) {
            $replace = [];
            foreach ($context as $key => $val) {
                $replace['{' . $key . '}'] = $val;
            }

            $msg = strtr($msg, $replace);
        }

        $this->log[$type][] = $msg;

        if (PHP_SAPI == 'cli') {
            // 命令行日志实时写入
            $this->save();
        }

        return $this;
    }
590519
private function _writeLog($msg) {
        $log = "-------------------------------------\n";
        $log .= date('Y-m-d H:i:s') . ":\n";
        $log .= $msg."\n";
        $log .= "-------------------------------------\n";
        file_put_contents($this->_output, $log, FILE_APPEND | LOCK_EX);
    }
794023
public function info($msg, $fileHandle = null)
    {
        $this->log(self::$logLevelInfo, $msg, $fileHandle = null);
    }
756822
public function debug($msg, $fileHandle = null)
    {
        $this->log(self::$logLevelDebug, $msg, $fileHandle);
    }
286531
protected function log($type, $msg)
    {
        $msg    = trim($msg);
        if ('' == $msg) {
            return false;
        }

        $filesystem = $this->filesystem;
        if (!$filesystem->isDirectory($this->dirPath)) {
            return false;
        }

        $type       = intval($type);
        $subPath    = sprintf("%s%s%s%s", date('Y'), DIRECTORY_SEPARATOR, date('m'), DIRECTORY_SEPARATOR);
        $file       = $this->dirPath . DIRECTORY_SEPARATOR . $subPath;
        switch($type) {
            case self::TYPE_DEBUG:
                $file   .= "debug";
                $str     = "[debug]";
                break;
            case self::TYPE_INFO:
                $file   .= "info";
                $str     = "[info]";
                break;
            case self::TYPE_NOTICE:
                $file   .= "notice";
                $str     = "[notice]";
                break;
            case self::TYPE_WARNING:
                $file   .= "warning";
                $str     = "[warning]";
                break;
            case self::TYPE_ERROR:
                $file   .= "error";
                $str     = "[error]";
                break;
            case self::TYPE_API:
                $file   .= "api";
                $str     = "[api]";
                break;
            case self::TYPE_DB:
                $file   .= "db";
                $str     = "[db]";
                break;
            // @codeCoverageIgnoreStart
            default:
                return false;
        }
        // @codeCoverageIgnoreEnd
        $file       .= '_' . date('Y_m_d');
        $target     = $file . '_' . date('His') . '.log';
        $file       .= '.log';

        // check log file size
        if ($filesystem->isFile($file) && ($filesystem->size($file) > self::MAX_FILE_SIZE)) {
            $filesystem->move($file, $target);
        }

        // Determine if log dir exists
        $dirPath    = $filesystem->dirName($file);
        if (!$filesystem->isDirectory($dirPath)) {
            $filesystem->makeDirectory($dirPath, 0755, true, true);
        }

        $str        .= date('Y-m-d H:i:s') . '|' . $msg . "\n";

        return $filesystem->append($file, $str) > 0;
    }
88401
protected function log ($msg = '', $logType = 'debug') {
		if (self::$loggingAndExceptions) {
			\MvcCore\Debug::Log($msg, $logType);
		}
	}
595145
private function _log($resources, $msg = 'Disabled following resources:')
    {
        if ($this->enableLog) {
            $this->writeLog($msg . "\n" . var_export($resources, true));
        }
    }
771783
public void log(int logLevel, String msg, Throwable tr) {
    println(logLevel, msg, tr);
  }
335443
public function log($msg, $level = Project::MSG_INFO)
    {
        if ($this->project !== null) {
            $this->project->log("[filter:" . get_class($this) . "] " . $msg, $level);
        }
    }
1258419
function (classpath, msg) {
            this._logs[this._nbLogs++] = {
                classpath : classpath,
                msg : msg,
                timestamp : (new Date()).getTime()
            };
        }
762151
public static function log($msg)
    {
        if (!self::$_enabled) {
            return;
        }

        if (is_null(self::$_file)) {
            echo "log: $msg\n";
            return;
        }

        return self::_logToFile($msg);
    }
1130542
public static function log(string $msg, array $data = [], int $level = self::VERB_DEBUG, array $opts = []): void
    {
        $levelName  = self::LEVEL_NAMES[$level] ?? 'INFO';
        $colorName  = self::LEVEL2TAG[$level] ?? 'info';
        $taggedName = ColorTag::add($levelName, $colorName);

        $userOpts = [];
        foreach ($opts as $n => $v) {
            if (\is_numeric($n) || \strpos($n, '_') === 0) {
                $userOpts[] = "[$v]";
            } else {
                $userOpts[] = "[$n:$v]";
            }
        }

        $optString = $userOpts ? ' ' . \implode(' ', $userOpts) : '';

        self::write(\sprintf(
            '%s [%s]%s %s %s',
            \date('Y/m/d H:i:s'),
            $taggedName,
            $optString,
            \trim($msg),
            $data ? \PHP_EOL . \json_encode($data, \JSON_UNESCAPED_SLASHES | \JSON_PRETTY_PRINT) : ''
        ));
    }
454462
protected function logPHPDebug($function, $msg) {
		if ($this->classparams['debug_php'] === true) {
			$output = "[DEBUG] [$function] ".$this->arrayexpand($msg);
			error_log($output);
		}
	}