Commit 6f24c497 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #124 in ZP/z-push from feature/ZP-765-zlog-syslog-refactor to develop

* commit 'a66f8222':
  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.
parents 7d46686c a66f8222
......@@ -163,7 +163,7 @@ class ZLog {
global $specialLogUsers; // This variable comes from the configuration file (config.php)
$logger = LOGBACKEND;
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()));
......
......@@ -80,9 +80,9 @@ class FileLog extends Log {
* @return string
*/
public function BuildLogString($loglevel, $message) {
$log = Utils::GetFormattedTime() . $this->GetPidstr() . $this->GetLogLevelString($loglevel, $loglevel >= LOGLEVEL_INFO) . ' ' . $this->GetUser();
if ($loglevel >= LOGLEVEL_DEVICEID) {
$log .= $this->GetDevid();
$log = Utils::GetFormattedTime() . ' ' . $this->GetPidstr() . ' ' . $this->GetLogLevelString($loglevel, $loglevel >= LOGLEVEL_INFO) . ' ' . $this->GetUser();
if (LOGLEVEL >= LOGLEVEL_DEVICEID || (LOGUSERLEVEL >= LOGLEVEL_DEVICEID && $this->IsAuthUserInSpecialLogUsers())) {
$log .= ' ' . $this->GetDevid();
}
$log .= ' ' . $message;
return $log;
......
......@@ -233,7 +233,7 @@ abstract class Log {
foreach ($this->unauthMessageCache as $authcache) {
$this->WriteForUser($authcache[0], $authcache[1]);
}
self::$unAuthCache = array();
$this->unauthMessageCache = array();
}
$this->WriteForUser($loglevel, $message);
}
......
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