SeasLog::warning

(PECL seaslog >=1.0.0)

SeasLog::warningRecord warning log information

说明

publicstaticSeasLog::warning(string$message, array$content = ?, string$logger = ?): bool

记录 warning 日志信息。

注意:

“WARNING”——出现了非错误性的异常信息、潜在异常信息、需要关注并且需要修复。

参数

message

日志信息。

content

`message` 包含占位符,实现用 content 数组中的值替换这些占位符。 例如 `message` 是 `log info from {NAME}`,`content` 是 `array('NAME' => neeke)`, 日志信息是 `log info from neeke`。

logger

当函数调用 SeasLog::setLogger() 时,就像临时 logger 一样,在第三个参数中使用这个 `logger`。 如果 `logger` 为 NULL 或 "",那么 SeasLog 将使用由 SeasLog::setLogger() 设置的最新日志记录程序。

返回值

记录日志信息成功返回 TRUE,失败返回 FALSE。

示例

示例 #1 SeasLog::warning() 示例

<?php

var_dump
(SeasLog::warning('log message'));

//with content
var_dump(SeasLog::warning('log message from {NAME}',array('NAME' => 'neeke')));

//with tmp logger
var_dump(SeasLog::warning('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 | WARNING | 73263 | 5b40376d1067c | 1530935149.68 | log message " [1]=> string(92) "2018-07-07 11:45:49 | WARNING | 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 | WARNING | 73263 | 5b40376d1067c | 1530935149.68 | log message from neeke " } }

参见

To Top