阅读(1007) (13)

Laravel 8 logger() {#collection-method}

2021-07-05 10:24:19 更新

logger 函数可以被用于将 debug 级别的消息写入 log:
The logger function can be used to write a debug level message to the log:

logger('Debug message');

可以将上下文数据数组传递给此函数:

logger('User has logged in.', ['id' => $user->id]); 

如果不带参数调用此函数,它将返回 logger 实例:

logger()->error('You are not allowed here.');