const DATA = 4;
const ALL = 5;
- public static $levels = [];
-
- /**
- * @brief Get class constants, and avoid using substring.
- */
- public static function getConstants()
- {
- $reflectionClass = new ReflectionClass(__CLASS__);
- return $reflectionClass->getConstants();
- }
+ public static $levels = [
+ self::WARNING => 'Warning',
+ self::INFO => 'Info',
+ self::TRACE => 'Trace',
+ self::DEBUG => 'Debug',
+ self::DATA => 'Data',
+ self::ALL => 'All',
+ ];
/**
* @brief Logs the given message at the given log level
return;
}
- if (count(self::$levels) == 0)
- {
- foreach (self::getConstants() as $k => $v)
- {
- $levels[$v] = $k;
- }
- }
-
$processId = session_id();
if ($processId == '')
$logline = sprintf("%s@%s\t[%s]:%s:%s:%s\t%s\n",
DateTimeFormat::utcNow(DateTimeFormat::ATOM),
$processId,
- $levels[$level],
+ self::$levels[$level],
basename($callers[0]['file']),
$callers[0]['line'],
$function,
* personally without background noise
*
* @param string $msg
- * @param int $level
*/
- public static function devLog($msg, $level = self::INFO)
+ public static function devLog($msg)
{
$a = self::getApp();
return;
}
- if (count(self::$levels) == 0)
- {
- foreach (self::getConstants() as $k => $v)
- {
- $levels[$v] = $k;
- }
- }
-
$processId = session_id();
if ($processId == '')