diff options
author | diosmosis <benakamoorthi@fastmail.fm> | 2014-08-30 13:02:04 +0400 |
---|---|---|
committer | diosmosis <benakamoorthi@fastmail.fm> | 2014-08-30 13:02:04 +0400 |
commit | 6858713386578aebdf354208eb97eb7f61ae1beb (patch) | |
tree | 463aefe03e95379539920d989a7de75459cbd3cc /core | |
parent | 48c8193f770186029ad0120a011fb517364d8e80 (diff) |
Make sure arrays are formatted correctly in Log calls w/ sprintf params and indent message newlines so they can be more easily parsed.
Diffstat (limited to 'core')
-rw-r--r-- | core/Log.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/Log.php b/core/Log.php index 4e505f7b63..54b96a8302 100644 --- a/core/Log.php +++ b/core/Log.php @@ -418,6 +418,13 @@ class Log extends Singleton if (is_string($message) && !empty($sprintfParams) ) { + // handle array sprintf parameters + foreach ($sprintfParams as &$param) { + if (is_array($param)) { + $param = json_encode($param); + } + } + $message = vsprintf($message, $sprintfParams); } @@ -676,6 +683,8 @@ class Log extends Singleton */ Piwik::postEvent(self::FORMAT_FILE_MESSAGE_EVENT, array(&$message, $level, $tag, $datetime, $logger)); } + + $message = str_replace("\n", "\n ", $message); return $message . "\n"; } } |