@@ -16,7 +16,7 @@ |
||
16 | 16 | |
17 | 17 | /** |
18 | 18 | */ |
19 | -interface LogOutputInterface{ |
|
19 | +interface LogOutputInterface { |
|
20 | 20 | |
21 | 21 | const E_NULL = 0x00; |
22 | 22 | const E_ALL = 0xff; |
@@ -14,9 +14,9 @@ |
||
14 | 14 | |
15 | 15 | /** |
16 | 16 | */ |
17 | -class ServerErrorlog extends LogOutputAbstract{ |
|
17 | +class ServerErrorlog extends LogOutputAbstract { |
|
18 | 18 | |
19 | - protected function __log(string $level, string $message, array $context = null){ |
|
19 | + protected function __log(string $level, string $message, array $context = null) { |
|
20 | 20 | // TODO: Implement log() method. |
21 | 21 | } |
22 | 22 |
@@ -20,9 +20,9 @@ |
||
20 | 20 | * is a good way to avoid littering your code with `if ($this->logger) { }` |
21 | 21 | * blocks. |
22 | 22 | */ |
23 | -class NullLogger extends LogOutputAbstract{ |
|
23 | +class NullLogger extends LogOutputAbstract { |
|
24 | 24 | |
25 | - protected function __log(string $level, string $message, array $context = null){ |
|
25 | + protected function __log(string $level, string $message, array $context = null) { |
|
26 | 26 | // go along, nothing to see here. |
27 | 27 | } |
28 | 28 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | /** |
18 | 18 | */ |
19 | -class Syslog extends LogOutputAbstract{ |
|
19 | +class Syslog extends LogOutputAbstract { |
|
20 | 20 | |
21 | 21 | const syslogLevels = [ |
22 | 22 | LogLevel::DEBUG => LOG_DEBUG, |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | LogLevel::EMERGENCY => LOG_EMERG, |
30 | 30 | ]; |
31 | 31 | |
32 | - protected function __log(string $level, string $message, array $context = null){ |
|
32 | + protected function __log(string $level, string $message, array $context = null) { |
|
33 | 33 | syslog($this::syslogLevels[$level], $message); |
34 | 34 | } |
35 | 35 |
@@ -12,4 +12,4 @@ |
||
12 | 12 | |
13 | 13 | namespace chillerlan\Logger; |
14 | 14 | |
15 | -class LogException extends \Exception{} |
|
15 | +class LogException extends \Exception {} |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | use Psr\Log\LogLevel; |
16 | 16 | |
17 | -trait LogOptionsTrait{ |
|
17 | +trait LogOptionsTrait { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * @see \Psr\Log\LogLevel |
@@ -23,6 +23,6 @@ |
||
23 | 23 | * @property string $logfileName |
24 | 24 | * @property string $logfileExt |
25 | 25 | */ |
26 | -class LogOptions extends ImmutableSettingsAbstract{ |
|
26 | +class LogOptions extends ImmutableSettingsAbstract { |
|
27 | 27 | use LogOptionsTrait; |
28 | 28 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | use chillerlan\Logger\Output\LogOutputInterface; |
16 | 16 | use Psr\Log\{LoggerInterface, LoggerTrait}; |
17 | 17 | |
18 | -class Log implements LoggerInterface{ |
|
18 | +class Log implements LoggerInterface { |
|
19 | 19 | use LoggerTrait; |
20 | 20 | |
21 | 21 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * @return void |
28 | 28 | */ |
29 | - public function __destruct(){ |
|
29 | + public function __destruct() { |
|
30 | 30 | $this->close(); |
31 | 31 | } |
32 | 32 | |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function close():Log{ |
39 | 39 | |
40 | - if(!empty($this->logOutputInterfaces)){ |
|
41 | - foreach($this->logOutputInterfaces as $instanceName => $instance){ |
|
40 | + if (!empty($this->logOutputInterfaces)) { |
|
41 | + foreach ($this->logOutputInterfaces as $instanceName => $instance) { |
|
42 | 42 | unset($this->logOutputInterfaces[$instanceName]); |
43 | 43 | } |
44 | 44 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function getInstance(string $instanceName):LogOutputInterface{ |
68 | 68 | |
69 | - if(!array_key_exists($instanceName, $this->logOutputInterfaces)){ |
|
69 | + if (!array_key_exists($instanceName, $this->logOutputInterfaces)) { |
|
70 | 70 | throw new LogException('invalid logger instance: '.$instanceName); |
71 | 71 | } |
72 | 72 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function removeInstance(string $instanceName):Log{ |
83 | 83 | |
84 | - if(!array_key_exists($instanceName, $this->logOutputInterfaces)){ |
|
84 | + if (!array_key_exists($instanceName, $this->logOutputInterfaces)) { |
|
85 | 85 | throw new LogException('invalid logger instance: '.$instanceName); |
86 | 86 | } |
87 | 87 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function log($level, $message, array $context = [], string $instance = null):void{ |
105 | 105 | |
106 | - foreach($this->logOutputInterfaces as $logger){ |
|
106 | + foreach ($this->logOutputInterfaces as $logger) { |
|
107 | 107 | $logger->log($level, $message, $context); |
108 | 108 | } |
109 | 109 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | use chillerlan\Logger\LogException; |
16 | 16 | use chillerlan\Traits\ImmutableSettingsInterface; |
17 | 17 | |
18 | -class FileLog extends LogOutputAbstract{ |
|
18 | +class FileLog extends LogOutputAbstract { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var bool|resource |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @throws \chillerlan\Logger\LogException |
31 | 31 | */ |
32 | - public function __construct(ImmutableSettingsInterface $options = null){ |
|
32 | + public function __construct(ImmutableSettingsInterface $options = null) { |
|
33 | 33 | parent::__construct($options); |
34 | 34 | |
35 | - if(!is_writable($this->options->logfileDir)){ |
|
35 | + if (!is_writable($this->options->logfileDir)) { |
|
36 | 36 | throw new LogException('log file directory inaccessible'); |
37 | 37 | } |
38 | 38 | |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | /** |
45 | 45 | * @inheritdoc |
46 | 46 | */ |
47 | - public function __destruct(){ |
|
47 | + public function __destruct() { |
|
48 | 48 | $this->close(); |
49 | 49 | |
50 | - if(gettype($this->fh) === 'resource'){ |
|
50 | + if (gettype($this->fh) === 'resource') { |
|
51 | 51 | fclose($this->fh); |
52 | 52 | } |
53 | 53 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @inheritdoc |
57 | 57 | */ |
58 | - protected function __log(string $level, string $message, array $context = null){ |
|
58 | + protected function __log(string $level, string $message, array $context = null) { |
|
59 | 59 | fwrite($this->fh, $this->message($level, $message, $context)); |
60 | 60 | } |
61 | 61 |