mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-22 18:09:06 +01:00
LSlog: add TRACE log level
This commit is contained in:
parent
42e6437966
commit
f234709722
8 changed files with 55 additions and 8 deletions
|
@ -60,6 +60,7 @@ de l'application.</para>
|
||||||
journal de l'application. Les niveaux de journalisation gérés par
|
journal de l'application. Les niveaux de journalisation gérés par
|
||||||
l'application sont (dans l'ordre du plus petit au plus grand) :</simpara>
|
l'application sont (dans l'ordre du plus petit au plus grand) :</simpara>
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
|
<listitem><simpara>TRACE</simpara></listitem>
|
||||||
<listitem><simpara>DEBUG</simpara></listitem>
|
<listitem><simpara>DEBUG</simpara></listitem>
|
||||||
<listitem><simpara>INFO</simpara></listitem>
|
<listitem><simpara>INFO</simpara></listitem>
|
||||||
<listitem><simpara>WARNING</simpara></listitem>
|
<listitem><simpara>WARNING</simpara></listitem>
|
||||||
|
|
|
@ -250,7 +250,7 @@ $GLOBALS['LSlog']['loggers'] = array (
|
||||||
),
|
),
|
||||||
*/
|
*/
|
||||||
);
|
);
|
||||||
$GLOBALS['LSlog']['level'] = 'INFO'; // DEBUG, INFO, WARNING, ERROR, FATAL
|
$GLOBALS['LSlog']['level'] = 'INFO'; // TRACE, DEBUG, INFO, WARNING, ERROR, FATAL
|
||||||
$GLOBALS['LSlog']['enable'] = true;
|
$GLOBALS['LSlog']['enable'] = true;
|
||||||
|
|
||||||
define('NB_LSOBJECT_LIST',30);
|
define('NB_LSOBJECT_LIST',30);
|
||||||
|
|
|
@ -46,11 +46,12 @@ class LSlog {
|
||||||
|
|
||||||
// Levels
|
// Levels
|
||||||
private static $levels=array(
|
private static $levels=array(
|
||||||
'DEBUG' => 0,
|
'TRACE' => 0,
|
||||||
'INFO' => 1,
|
'DEBUG' => 1,
|
||||||
'WARNING' => 2,
|
'INFO' => 2,
|
||||||
'ERROR' => 3,
|
'WARNING' => 3,
|
||||||
'FATAL' => 4,
|
'ERROR' => 4,
|
||||||
|
'FATAL' => 5,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Current existing loggers
|
// Current existing loggers
|
||||||
|
@ -176,7 +177,7 @@ class LSlog {
|
||||||
self :: $level = $level;
|
self :: $level = $level;
|
||||||
|
|
||||||
// Set PHP error/exception handlers
|
// Set PHP error/exception handlers
|
||||||
if (self :: $level == 'DEBUG')
|
if (in_array(self :: $level, array('DEBUG', 'TRACE')))
|
||||||
set_error_handler(array('LSlog', 'php_error'), E_ALL & ~E_STRICT);
|
set_error_handler(array('LSlog', 'php_error'), E_ALL & ~E_STRICT);
|
||||||
else
|
else
|
||||||
set_error_handler(array('LSlog', 'php_error'), E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
|
set_error_handler(array('LSlog', 'php_error'), E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
|
||||||
|
@ -403,6 +404,17 @@ class LSlog {
|
||||||
* Public logging methods
|
* Public logging methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log a message with level TRACE
|
||||||
|
*
|
||||||
|
* @param[in] $message The message to log
|
||||||
|
*
|
||||||
|
* @retval void
|
||||||
|
**/
|
||||||
|
public static function trace($message) {
|
||||||
|
self :: logging('TRACE', $message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a message with level DEBUG
|
* Log a message with level DEBUG
|
||||||
*
|
*
|
||||||
|
|
|
@ -55,7 +55,7 @@ class LSlog_console extends LSlog_handler {
|
||||||
**/
|
**/
|
||||||
public function logging($level, $message, $logger=null) {
|
public function logging($level, $message, $logger=null) {
|
||||||
return fwrite(
|
return fwrite(
|
||||||
(in_array($level, array('INFO', 'DEBUG'))?$this -> stdout:$this -> stderr),
|
(in_array($level, array('INFO', 'DEBUG', 'TRACE'))?$this -> stdout:$this -> stderr),
|
||||||
$this -> format($level, $message, $logger)."\n"
|
$this -> format($level, $message, $logger)."\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,6 +123,17 @@ class LSlog_logger {
|
||||||
* Public logging methods
|
* Public logging methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log a message with level DEBUG
|
||||||
|
*
|
||||||
|
* @param[in] $message The message to log
|
||||||
|
*
|
||||||
|
* @retval void
|
||||||
|
**/
|
||||||
|
public function trace($message) {
|
||||||
|
$this -> logging('TRACE', $message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a message with level DEBUG
|
* Log a message with level DEBUG
|
||||||
*
|
*
|
||||||
|
|
|
@ -52,6 +52,17 @@ class LSlog_staticLoggerClass {
|
||||||
LSlog :: get_logger(get_called_class()) -> exception($exception, $prefix, $fatal);
|
LSlog :: get_logger(get_called_class()) -> exception($exception, $prefix, $fatal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log a message with level TRACE
|
||||||
|
*
|
||||||
|
* @param[in] $message The message to log
|
||||||
|
*
|
||||||
|
* @retval void
|
||||||
|
**/
|
||||||
|
protected static function log_trace($message) {
|
||||||
|
self :: log('TRACE', $message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a message with level DEBUG
|
* Log a message with level DEBUG
|
||||||
*
|
*
|
||||||
|
|
|
@ -40,6 +40,7 @@ class LSlog_syslog extends LSlog_handler {
|
||||||
'NOTICE' => LOG_NOTICE, // normal, but significant, condition
|
'NOTICE' => LOG_NOTICE, // normal, but significant, condition
|
||||||
'INFO' => LOG_INFO, // informational message
|
'INFO' => LOG_INFO, // informational message
|
||||||
'DEBUG' => LOG_DEBUG, // debug-level message
|
'DEBUG' => LOG_DEBUG, // debug-level message
|
||||||
|
'TRACE' => LOG_DEBUG, // also debug-level message
|
||||||
);
|
);
|
||||||
|
|
||||||
// Default syslog priority (used if level is not provided or invalid)
|
// Default syslog priority (used if level is not provided or invalid)
|
||||||
|
|
|
@ -240,6 +240,17 @@ class LSsession {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log a message with level TRACE
|
||||||
|
*
|
||||||
|
* @param[in] $message The message to log
|
||||||
|
*
|
||||||
|
* @retval void
|
||||||
|
**/
|
||||||
|
protected static function log_trace($message) {
|
||||||
|
self :: log('TRACE', $message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a message with level DEBUG
|
* Log a message with level DEBUG
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue