Review Updates
create array, remove getConstants function, add self references.
This commit is contained in:
parent
342e484533
commit
17ae53c9d7
1 changed files with 10 additions and 29 deletions
|
@ -22,16 +22,14 @@ class Logger extends BaseObject
|
||||||
const DATA = 4;
|
const DATA = 4;
|
||||||
const ALL = 5;
|
const ALL = 5;
|
||||||
|
|
||||||
public static $levels = [];
|
public static $levels = [
|
||||||
|
self::WARNING => 'Warning',
|
||||||
/**
|
self::INFO => 'Info',
|
||||||
* @brief Get class constants, and avoid using substring.
|
self::TRACE => 'Trace',
|
||||||
*/
|
self::DEBUG => 'Debug',
|
||||||
public static function getConstants()
|
self::DATA => 'Data',
|
||||||
{
|
self::ALL => 'All',
|
||||||
$reflectionClass = new ReflectionClass(__CLASS__);
|
];
|
||||||
return $reflectionClass->getConstants();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Logs the given message at the given log level
|
* @brief Logs the given message at the given log level
|
||||||
|
@ -55,14 +53,6 @@ class Logger extends BaseObject
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count(self::$levels) == 0)
|
|
||||||
{
|
|
||||||
foreach (self::getConstants() as $k => $v)
|
|
||||||
{
|
|
||||||
$levels[$v] = $k;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$processId = session_id();
|
$processId = session_id();
|
||||||
|
|
||||||
if ($processId == '')
|
if ($processId == '')
|
||||||
|
@ -81,7 +71,7 @@ class Logger extends BaseObject
|
||||||
$logline = sprintf("%s@%s\t[%s]:%s:%s:%s\t%s\n",
|
$logline = sprintf("%s@%s\t[%s]:%s:%s:%s\t%s\n",
|
||||||
DateTimeFormat::utcNow(DateTimeFormat::ATOM),
|
DateTimeFormat::utcNow(DateTimeFormat::ATOM),
|
||||||
$processId,
|
$processId,
|
||||||
$levels[$level],
|
self::$levels[$level],
|
||||||
basename($callers[0]['file']),
|
basename($callers[0]['file']),
|
||||||
$callers[0]['line'],
|
$callers[0]['line'],
|
||||||
$function,
|
$function,
|
||||||
|
@ -100,9 +90,8 @@ class Logger extends BaseObject
|
||||||
* personally without background noise
|
* personally without background noise
|
||||||
*
|
*
|
||||||
* @param string $msg
|
* @param string $msg
|
||||||
* @param int $level
|
|
||||||
*/
|
*/
|
||||||
public static function devLog($msg, $level = self::INFO)
|
public static function devLog($msg)
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
|
|
||||||
|
@ -119,14 +108,6 @@ class Logger extends BaseObject
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count(self::$levels) == 0)
|
|
||||||
{
|
|
||||||
foreach (self::getConstants() as $k => $v)
|
|
||||||
{
|
|
||||||
$levels[$v] = $k;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$processId = session_id();
|
$processId = session_id();
|
||||||
|
|
||||||
if ($processId == '')
|
if ($processId == '')
|
||||||
|
|
Loading…
Reference in a new issue