SeasLog::notice()
(PECL seaslog >=1.0.0)
记录 notice 日志
说明
public static SeasLog::notice(string $message[,array $content[,string $logger]]): bool
记录 notice 日志。
Note:"NOTICE"- 一般重要性事件、执行过程中较 INFO 级别更为重要的信息。
参数
- $message
日志的消息
- $content
"消息"包含占位符,实现用 content 数组中的值替换这些占位符。例如'消息'是`log info from{NAME}`,'内容'是`array('NAME'=> neeke)`,日志信息是`log info from neeke`
- $logger
当函数调用 SeasLog::setLogger()时,就像临时 logger 一样,在第三个参数中使用这个"logger"。如果`logger`为 NULL 或"",那么 SeasLog 将使用由SeasLog::setLogger()设置的最新 Logger。
返回值
记录日志信息成功返回 TRUE,失败返回 FALSE。
范例
Example #1 SeasLog::notice() example
<?php var_dump(SeasLog::notice('log message')); //with content var_dump(SeasLog::notice('log message from {NAME}',array('NAME' => 'neeke'))); //with tmp logger var_dump(SeasLog::notice('log message from {NAME}',array('NAME' => 'neeke'),'tmp_logger')); var_dump(SeasLog::getBuffer()); ?>
以上例程的输出类似于:
bool(true) bool(true) bool(true) array(2) { ["/var/log/www/default/20180707.log"]=> array(2) { [0]=> string(81) "2018-07-07 11:45:49 | NOTICE | 73263 | 5b40376d1067c | 1530935149.68 | log message " [1]=> string(92) "2018-07-07 11:45:49 | NOTICE | 73263 | 5b40376d1067c | 1530935149.68 | log message from neeke " } ["/var/log/www/tmp_logger/20180707.log"]=> array(1) { [0]=> string(92) "2018-07-07 11:45:49 | NOTICE | 73263 | 5b40376d1067c | 1530935149.68 | log message from neeke " } }
参见
- seaslog.default_template
- SeasLog::debug() 记录 debug 日志
- SeasLog::info() Record info log information
- SeasLog::warning() Record warning log information
- SeasLog::error() 记录 error 日志
- SeasLog::critical() 记录 critical 日志
- SeasLog::alert() 记录 alert 日志
- SeasLog::emergency() 记录 emergency 日志
- SeasLog::log() 公共的日志记录函数