Skip to content

Commit 1a8d19d

Browse files
committed
Fiddling some more with logging...
1 parent 7602463 commit 1a8d19d

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

src/PHPLogger.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -136,22 +136,20 @@ private function _log($level, $message)
136136
$message
137137
);
138138

139-
switch($this->_mode)
139+
if (0 === $this->_mode || 3 === $this->_mode || 4 === $this->_mode)
140140
{
141-
case 0:
142-
case 3:
143-
case 4:
144-
$ok = @error_log($message);
145-
break;
146-
case 1:
147-
$ok = @error_log($message, $this->_mode, $this->_destination, $this->_extraHeaders);
148-
break;
149-
150-
default:
151-
throw new \Exception(sprintf(
152-
'PHPLogger - Invalid state seen, $mode is not set to a valid value! Current mode: "%s"',
153-
is_int($this->_mode) ? $this->_mode : gettype($this->_mode)
154-
));
141+
$ok = @error_log($message);
142+
}
143+
else if (1 === $this->_mode)
144+
{
145+
$ok = @error_log($message, $this->_mode, $this->_destination, $this->_extraHeaders);
146+
}
147+
else
148+
{
149+
throw new \Exception(sprintf(
150+
'PHPLogger - Invalid state seen, $mode is not set to a valid value! Current mode: "%s"',
151+
is_int($this->_mode) ? $this->_mode : gettype($this->_mode)
152+
));
155153
}
156154

157155
if ($ok)

0 commit comments

Comments
 (0)