Commit a66f8222 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-765 Fixed missing spaces in log string. Fixed LOGLEVEL_DEVICEID so it

works as expected. Fixed access of Log->unauthMessageCache - is now an
instance variable. Fixed indentation. Throw a
FatalNotImplementedException instead of a simple Exception.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 701c5142
...@@ -163,7 +163,7 @@ class ZLog { ...@@ -163,7 +163,7 @@ class ZLog {
global $specialLogUsers; // This variable comes from the configuration file (config.php) global $specialLogUsers; // This variable comes from the configuration file (config.php)
$logger = LOGBACKEND; $logger = LOGBACKEND;
if (!class_exists($logger)) { if (!class_exists($logger)) {
throw new \Exception('The class `'.$logger.'` does not exist.'); throw new FatalNotImplementedException('The logging class `'.$logger.'` does not exist.');
} }
list($user) = Utils::SplitDomainUser(strtolower(Request::GetGETUser())); list($user) = Utils::SplitDomainUser(strtolower(Request::GetGETUser()));
......
...@@ -80,9 +80,9 @@ class FileLog extends Log { ...@@ -80,9 +80,9 @@ class FileLog extends Log {
* @return string * @return string
*/ */
public function BuildLogString($loglevel, $message) { public function BuildLogString($loglevel, $message) {
$log = Utils::GetFormattedTime() . $this->GetPidstr() . $this->GetLogLevelString($loglevel, $loglevel >= LOGLEVEL_INFO) . ' ' . $this->GetUser(); $log = Utils::GetFormattedTime() . ' ' . $this->GetPidstr() . ' ' . $this->GetLogLevelString($loglevel, $loglevel >= LOGLEVEL_INFO) . ' ' . $this->GetUser();
if ($loglevel >= LOGLEVEL_DEVICEID) { if (LOGLEVEL >= LOGLEVEL_DEVICEID || (LOGUSERLEVEL >= LOGLEVEL_DEVICEID && $this->IsAuthUserInSpecialLogUsers())) {
$log .= $this->GetDevid(); $log .= ' ' . $this->GetDevid();
} }
$log .= ' ' . $message; $log .= ' ' . $message;
return $log; return $log;
......
...@@ -233,7 +233,7 @@ abstract class Log { ...@@ -233,7 +233,7 @@ abstract class Log {
foreach ($this->unauthMessageCache as $authcache) { foreach ($this->unauthMessageCache as $authcache) {
$this->WriteForUser($authcache[0], $authcache[1]); $this->WriteForUser($authcache[0], $authcache[1]);
} }
self::$unAuthCache = array(); $this->unauthMessageCache = array();
} }
$this->WriteForUser($loglevel, $message); $this->WriteForUser($loglevel, $message);
} }
...@@ -275,15 +275,15 @@ abstract class Log { ...@@ -275,15 +275,15 @@ abstract class Log {
else else
$s = ""; $s = "";
switch($loglevel) { switch($loglevel) {
case LOGLEVEL_OFF: return ""; break; case LOGLEVEL_OFF: return ""; break;
case LOGLEVEL_FATAL: return "[FATAL]"; break; case LOGLEVEL_FATAL: return "[FATAL]"; break;
case LOGLEVEL_ERROR: return "[ERROR]"; break; case LOGLEVEL_ERROR: return "[ERROR]"; break;
case LOGLEVEL_WARN: return "[".$s."WARN]"; break; case LOGLEVEL_WARN: return "[".$s."WARN]"; break;
case LOGLEVEL_INFO: return "[".$s."INFO]"; break; case LOGLEVEL_INFO: return "[".$s."INFO]"; break;
case LOGLEVEL_DEBUG: return "[DEBUG]"; break; case LOGLEVEL_DEBUG: return "[DEBUG]"; break;
case LOGLEVEL_WBXML: return "[WBXML]"; break; case LOGLEVEL_WBXML: return "[WBXML]"; break;
case LOGLEVEL_DEVICEID: return "[DEVICEID]"; break; case LOGLEVEL_DEVICEID: return "[DEVICEID]"; break;
case LOGLEVEL_WBXMLSTACK: return "[WBXMLSTACK]"; break; case LOGLEVEL_WBXMLSTACK: return "[WBXMLSTACK]"; break;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment