From af01d7f02407a2aad2941360d6931c567334509f Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Mon, 24 Feb 2014 15:38:53 +1300 Subject: [PATCH] Adding defaults for unhandled event priorities in log formatters. Unhandled types wouldn't show up in the error format message, and a notice "undefined $errtype" is displayed on these cases. --- dev/LogErrorEmailFormatter.php | 3 +++ dev/LogErrorFileFormatter.php | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dev/LogErrorEmailFormatter.php b/dev/LogErrorEmailFormatter.php index 370a6d5e5..195aefcfd 100644 --- a/dev/LogErrorEmailFormatter.php +++ b/dev/LogErrorEmailFormatter.php @@ -23,6 +23,9 @@ class SS_LogErrorEmailFormatter implements Zend_Log_Formatter_Interface { $errorType = 'Notice'; $colour = 'grey'; break; + default: + $errorType = $event['priorityName']; + $colour = 'grey'; } if(!is_array($event['message'])) { diff --git a/dev/LogErrorFileFormatter.php b/dev/LogErrorFileFormatter.php index 9b4f82f9b..5a64d8ca7 100644 --- a/dev/LogErrorFileFormatter.php +++ b/dev/LogErrorFileFormatter.php @@ -15,7 +15,7 @@ class SS_LogErrorFileFormatter implements Zend_Log_Formatter_Interface { $errfile = $event['message']['errfile']; $errline = $event['message']['errline']; $errcontext = $event['message']['errcontext']; - + switch($event['priorityName']) { case 'ERR': $errtype = 'Error'; @@ -26,6 +26,8 @@ class SS_LogErrorFileFormatter implements Zend_Log_Formatter_Interface { case 'NOTICE': $errtype = 'Notice'; break; + default: + $errtype = $event['priorityName']; } $urlSuffix = '';