(PECL seaslog >=1.0.0)
SeasLog::notice — 記錄通知等級的日誌資訊
記錄通知等級的日誌資訊。
注意事項:
「NOTICE」- 正常但重要的事件。執行期間比 INFO 等級更重要的資訊。
message日誌訊息。
content`message` 包含佔位符,實作會將其替換為來自 `content` 陣列的值。例如,`message` 為 `log info from {NAME}` 且 `content` 為 `array('NAME' => neeke)`,則日誌資訊將為 `log info from neeke`。
logger當先前已呼叫 SeasLog::setLogger() 函式時,第三個參數指定的 `logger` 會被立即使用,如同一個臨時記錄器。如果 `logger` 為 NULL 或空字串,SeasLog 將使用 SeasLog::setLogger() 設定的最新記錄器。
記錄日誌資訊成功時回傳 TRUE,失敗時回傳 FALSE。
範例 #1 SeasLog::notice() 範例
<?php
var_dump(SeasLog::notice('log message'));
//使用 content
var_dump(SeasLog::notice('log message from {NAME}',array('NAME' => 'neeke')));
//使用臨時記錄器
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
"
}
}