mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-22 16:33:48 +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
|
||||
l'application sont (dans l'ordre du plus petit au plus grand) :</simpara>
|
||||
<itemizedlist>
|
||||
<listitem><simpara>TRACE</simpara></listitem>
|
||||
<listitem><simpara>DEBUG</simpara></listitem>
|
||||
<listitem><simpara>INFO</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;
|
||||
|
||||
define('NB_LSOBJECT_LIST',30);
|
||||
|
|
|
@ -46,11 +46,12 @@ class LSlog {
|
|||
|
||||
// Levels
|
||||
private static $levels=array(
|
||||
'DEBUG' => 0,
|
||||
'INFO' => 1,
|
||||
'WARNING' => 2,
|
||||
'ERROR' => 3,
|
||||
'FATAL' => 4,
|
||||
'TRACE' => 0,
|
||||
'DEBUG' => 1,
|
||||
'INFO' => 2,
|
||||
'WARNING' => 3,
|
||||
'ERROR' => 4,
|
||||
'FATAL' => 5,
|
||||
);
|
||||
|
||||
// Current existing loggers
|
||||
|
@ -176,7 +177,7 @@ class LSlog {
|
|||
self :: $level = $level;
|
||||
|
||||
// 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);
|
||||
else
|
||||
set_error_handler(array('LSlog', 'php_error'), E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
|
||||
|
@ -403,6 +404,17 @@ class LSlog {
|
|||
* 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
|
||||
*
|
||||
|
|
|
@ -55,7 +55,7 @@ class LSlog_console extends LSlog_handler {
|
|||
**/
|
||||
public function logging($level, $message, $logger=null) {
|
||||
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"
|
||||
);
|
||||
}
|
||||
|
|
|
@ -123,6 +123,17 @@ class LSlog_logger {
|
|||
* 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
|
||||
*
|
||||
|
|
|
@ -52,6 +52,17 @@ class LSlog_staticLoggerClass {
|
|||
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
|
||||
*
|
||||
|
|
|
@ -40,6 +40,7 @@ class LSlog_syslog extends LSlog_handler {
|
|||
'NOTICE' => LOG_NOTICE, // normal, but significant, condition
|
||||
'INFO' => LOG_INFO, // informational 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)
|
||||
|
|
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue