SeasLog::log
(PECL seaslog >=1.0.0)
SeasLog::log — The Common Record Log Function
Description
$level
[, string $message
[, array $content
[, string $logger
]]] ) : boolThe Common Record Log Function.
Parameters
-
level
-
Can use level in:
Or you can create a new level self-help. -
message
-
The log message.
-
content
-
The `message` contain placeholders which implementors replace with values from content array. Sush as `message` is `log info from {NAME}` and `content` is `array('NAME' => neeke)`, the log information will `log info from neeke`.
-
logger
-
The `logger` cased by the third param would be used right this right now, like a temp logger, when the function SeasLog::setLogger() called in pre content. If `logger` NULL or "", SeasLog will use lastest logger setted by SeasLog::setLogger().
Examples
Example #1 SeasLog::log() example
<?php
var_dump(SeasLog::log(SEASLOG_INFO,'info log'));
var_dump(SeasLog::getBuffer());
//create a new level self-help.
var_dump(SeasLog::log('MySelfLevel','info log'));
var_dump(SeasLog::getBuffer());
//with `content`
var_dump(SeasLog::log('MySelfLevel','info log {NAME}',array('NAME' => 'neeke')));
var_dump(SeasLog::getBuffer());
//with `logger`
var_dump(SeasLog::log('MySelfLevel','info log {NAME}',array('NAME' => 'neeke'),'tmp_logger'));
var_dump(SeasLog::getBuffer());
?>
The above example will output something similar to:
bool(true) array(1) { ["/var/log/www/default/20180707.log"]=> array(1) { [0]=> string(79) "2018-07-07 11:12:37 | INFO | 72427 | 5b402fa56a2ea | 1530933157.436 | info log " } } bool(true) array(1) { ["/var/log/www/default/20180707.log"]=> array(1) { [0]=> string(86) "2018-07-07 11:13:59 | MySelfLevel | 72470 | 5b402ff781c5e | 1530933239.532 | info log " } } bool(true) array(1) { ["/var/log/www/tmp_logger/20180707.log"]=> array(1) { [0]=> string(92) "2018-07-07 11:28:12 | MySelfLevel | 72833 | 5b40334ce6a2f | 1530934092.946 | info log neeke " } } bool(true) array(1) { ["/var/log/www/default/20180707.log"]=> array(1) { [0]=> string(86) "2018-07-07 11:20:12 | INFO | 72616 | 5b40316c3641e | 1530933612.222 | info log neeke " } }
See Also
- seaslog.default_template
- SeasLog::debug() - Record debug log information
- SeasLog::info() - Record info log information
- SeasLog::notice() - Record notice log information
- SeasLog::warning() - Record warning log information
- SeasLog::error() - Record error log information
- SeasLog::critical() - Record critical log information
- SeasLog::alert() - Record alert log information
- SeasLog::emergency() - Record emergency log information
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-seaslog.log.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.