Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Allow log plugins to handle variable number of \t
Browse files Browse the repository at this point in the history
Signed-off-by: Etienne CHAMPETIER <etienne.champetier@fiducial.net>
  • Loading branch information
Etienne CHAMPETIER committed Sep 9, 2013
1 parent 18ea9e7 commit 6d2fd41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/src/plugins/log.sql/class.sqlLogDriver.php
Expand Up @@ -98,7 +98,7 @@ public function formatMessage($message, $severity)
}
}

$message_parts = explode("\t", $message);
$message_parts = explode("\t", $message, 2);
$severity = strtoupper((string) $severity);

$log_row = Array(
Expand Down
10 changes: 5 additions & 5 deletions core/src/plugins/log.text/class.textLogDriver.php
Expand Up @@ -287,20 +287,20 @@ public function xmlLogs($parentDir, $date, $nodeName = "log", $rootPath = "/logs
$lines = file($fName);
foreach ($lines as $line) {
$line = AJXP_Utils::xmlEntities($line);
$matches = array();
if (preg_match("/(.*)\t(.*)\t(.*)\t(.*)\t(.*)\t(.*)$/", $line, $matches)!==false) {
$fileName = $parentDir."/".$matches[1];
$matches = explode("\t",$line,6);
if (count($matches) == 6) {
$fileName = $parentDir."/".$matches[0];
foreach ($matches as $key => $match) {
$match = AJXP_Utils::xmlEntities($match);
$match = str_replace("\"", "'", $match);
$matches[$key] = $match;
}
if(count($matches) < 3) continue;
// rebuild timestamp
$date = $matches[1];
$date = $matches[0];
list($m,$d,$Y,$h,$i,$s) = sscanf($date, "%i-%i-%i %i:%i:%i");
$tStamp = mktime($h,$i,$s,$m,$d,$Y);
print(SystemTextEncoding::toUTF8("<$nodeName is_file=\"1\" ajxp_modiftime=\"$tStamp\" filename=\"$fileName\" ajxp_mime=\"log\" date=\"$matches[1]\" ip=\"$matches[2]\" level=\"$matches[3]\" user=\"$matches[4]\" action=\"$matches[5]\" params=\"$matches[6]\" icon=\"toggle_log.png\" />", false));
print(SystemTextEncoding::toUTF8("<$nodeName is_file=\"1\" ajxp_modiftime=\"$tStamp\" filename=\"$fileName\" ajxp_mime=\"log\" date=\"$matches[0]\" ip=\"$matches[1]\" level=\"$matches[2]\" user=\"$matches[3]\" action=\"$matches[4]\" params=\"$matches[5]\" icon=\"toggle_log.png\" />", false));
}
}
return ;
Expand Down

0 comments on commit 6d2fd41

Please sign in to comment.