From 06bf821555a23ff7a891f58609557fe2459e2ff0 Mon Sep 17 00:00:00 2001 From: Jean Paul Galea Date: Thu, 10 Sep 2015 20:30:00 +0200 Subject: [PATCH] Refactor. - make it easier to follow, create prefix first, then suffix. --- ykval-log.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ykval-log.php b/ykval-log.php index 90123a7..d3e503c 100644 --- a/ykval-log.php +++ b/ykval-log.php @@ -56,8 +56,11 @@ class Log public function log ($priority, $message, $extra = NULL) { - $final = ''; + $fields = ''; + foreach ($this->fields as $val) + $fields .= "[$val] "; + $final = ''; if (is_array($extra)) { foreach($extra as $key => $value) { if (is_array($value)) { @@ -67,11 +70,6 @@ class Log } } - $fields = ''; - - foreach ($this->fields as $val) - $fields .= "[$val] "; - syslog($priority, $this->log_levels[$priority] . ':' . $this->name . ':' .