Skip to content
TIGERB edited this page May 21, 2017 · 1 revision

提供快捷的log函数easy_log($data = [], $fileName = 'debug'):

/**
 * log
 *
 * @param  array  $data     log数据
 * @param  string $fileName log文件名 绝对路径
 * @return void
 */
function easy_log($data = [], $fileName = 'debug')
{
    $time = date('Y-m-d H:i:s', time());
    error_log(
        "[{$time}]: " . json_encode($data, JSON_UNESCAPED_UNICODE)."\n",
        3,
        $fileName . '.log'
    );
}
Clone this wiki locally