0
点赞
收藏
分享

微信扫一扫

thinkphp5的日志写入


thinkphp5的配置文件

'log'   => [
// 日志记录方式,支持 file socket
'type' => 'File',
//日志保存目录
'path' => LOG_PATH,
//单个日志文件的大小限制,超过后会自动记录到第二个文件
'file_size' =>2097152,
//日志的时间格式,默认是` c `
'time_format' =>'c'
],

写入方法

/**
* 写日志
* @param string $msg 参数
* @param string $dir 参数
*/
public static function logWrite($msg,$dir='')
{
if ($dir)
{
Log::init(['path'=>$dir]);
}
Log::write($msg);
Log::init(['path'=>LOG_PATH]);
}


举报

相关推荐

0 条评论