log args
This commit is contained in:
parent
12bc4a90f7
commit
7c140680b7
@ -250,10 +250,16 @@ class LogEvent extends Event {
|
||||
*/
|
||||
var $time;
|
||||
|
||||
public function __construct($section, $priority, $message) {
|
||||
/**
|
||||
* Extra data to be held separate
|
||||
*/
|
||||
var $args;
|
||||
|
||||
public function __construct($section, $priority, $message, $args) {
|
||||
$this->section = $section;
|
||||
$this->priority = $priority;
|
||||
$this->message = $message;
|
||||
$this->args = $args;
|
||||
$this->time = time();
|
||||
}
|
||||
}
|
||||
|
@ -902,8 +902,8 @@ define("SCORE_LOG_NOTSET", 0);
|
||||
* $flash = true - show the message to the user as well
|
||||
* $flash = "some string" - log the message, flash the string
|
||||
*/
|
||||
function log_msg(/*string*/ $section, /*int*/ $priority, /*string*/ $message, $flash=null) {
|
||||
send_event(new LogEvent($section, $priority, $message));
|
||||
function log_msg(/*string*/ $section, /*int*/ $priority, /*string*/ $message, $flash=null, $args=array()) {
|
||||
send_event(new LogEvent($section, $priority, $message, $args));
|
||||
$threshold = defined("CLI_LOG_LEVEL") ? CLI_LOG_LEVEL : 0;
|
||||
if(is_cli() && ($priority >= $threshold)) {
|
||||
print date("c")." $section: $message\n";
|
||||
@ -917,11 +917,11 @@ function log_msg(/*string*/ $section, /*int*/ $priority, /*string*/ $message, $f
|
||||
}
|
||||
|
||||
// More shorthand ways of logging
|
||||
function log_debug( /*string*/ $section, /*string*/ $message, $flash=null) {log_msg($section, SCORE_LOG_DEBUG, $message, $flash);}
|
||||
function log_info( /*string*/ $section, /*string*/ $message, $flash=null) {log_msg($section, SCORE_LOG_INFO, $message, $flash);}
|
||||
function log_warning( /*string*/ $section, /*string*/ $message, $flash=null) {log_msg($section, SCORE_LOG_WARNING, $message, $flash);}
|
||||
function log_error( /*string*/ $section, /*string*/ $message, $flash=null) {log_msg($section, SCORE_LOG_ERROR, $message, $flash);}
|
||||
function log_critical(/*string*/ $section, /*string*/ $message, $flash=null) {log_msg($section, SCORE_LOG_CRITICAL, $message, $flash);}
|
||||
function log_debug( /*string*/ $section, /*string*/ $message, $flash=null, $args=array()) {log_msg($section, SCORE_LOG_DEBUG, $message, $flash, $args);}
|
||||
function log_info( /*string*/ $section, /*string*/ $message, $flash=null, $args=array()) {log_msg($section, SCORE_LOG_INFO, $message, $flash, $args);}
|
||||
function log_warning( /*string*/ $section, /*string*/ $message, $flash=null, $args=array()) {log_msg($section, SCORE_LOG_WARNING, $message, $flash, $args);}
|
||||
function log_error( /*string*/ $section, /*string*/ $message, $flash=null, $args=array()) {log_msg($section, SCORE_LOG_ERROR, $message, $flash, $args);}
|
||||
function log_critical(/*string*/ $section, /*string*/ $message, $flash=null, $args=array()) {log_msg($section, SCORE_LOG_CRITICAL, $message, $flash, $args);}
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||
|
Loading…
x
Reference in New Issue
Block a user