CodeIgniter 3 - 配置 log_threshold

ltd*_*dev 0 php codeigniter codeigniter-3

好吧,我糊涂了。

里面application/config.php在评论中说:

    | If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
|   0 = Disables logging, Error logging TURNED OFF
|   1 = Error Messages (including PHP errors)
|   2 = Debug Messages
|   3 = Informational Messages
|   4 = All Messages
|
| You can also pass an array with threshold levels to show individual error types
|
|   array(2) = Debug Messages, without Error Messages
Run Code Online (Sandbox Code Playgroud)

所以如果我想得到错误和调试消息而不是任何信息消息,我是否必须设置阈值

$config['log_threshold'] = 2;
Run Code Online (Sandbox Code Playgroud)

或者

$config['log_threshold'] = array(1, 2);
Run Code Online (Sandbox Code Playgroud)

有人可以给我一些澄清吗?

Nar*_*arf 5

两者都可以工作,因为信息性消息的值为 3,而您想要的最大值为 2。

但是,如果您想记录信息和错误消息,但不记录调试消息,则必须设置值array(1, 3)以跳过调试消息。