@@ -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; |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | */ |
| 20 | -class EmailLog extends LogOutputAbstract{ |
|
| 20 | +class EmailLog extends LogOutputAbstract { |
|
| 21 | 21 | |
| 22 | 22 | protected $mailer; |
| 23 | 23 | |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | * @param \chillerlan\Logger\LogOptions $options |
| 29 | 29 | * @param \PHPMailer\PHPMailer\PHPMailer $mailer |
| 30 | 30 | */ |
| 31 | - public function __construct(LogOptions $options, PHPMailer $mailer){ |
|
| 31 | + public function __construct(LogOptions $options, PHPMailer $mailer) { |
|
| 32 | 32 | $this->options = $options; |
| 33 | 33 | $this->mailer = $mailer; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - protected function __log(string $level, string $message, array $context = null){ |
|
| 36 | + protected function __log(string $level, string $message, array $context = null) { |
|
| 37 | 37 | // TODO: Implement log() method. |
| 38 | 38 | } |
| 39 | 39 | |
@@ -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 |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | use chillerlan\Database\Connection; |
| 16 | 16 | use chillerlan\Logger\LogOptions; |
| 17 | 17 | |
| 18 | -class DatabaseLog extends LogOutputAbstract{ |
|
| 18 | +class DatabaseLog extends LogOutputAbstract { |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * @var \chillerlan\Database\Connection |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param \chillerlan\Logger\LogOptions $options |
| 30 | 30 | * @param \chillerlan\Database\Connection $db |
| 31 | 31 | */ |
| 32 | - public function __construct(LogOptions $options, Connection $db){ |
|
| 32 | + public function __construct(LogOptions $options, Connection $db) { |
|
| 33 | 33 | $this->options = $options; |
| 34 | 34 | $this->db = $db; |
| 35 | 35 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | /** |
| 40 | 40 | * @inheritdoc |
| 41 | 41 | */ |
| 42 | - protected function __log(string $level, string $message, array $context = []){ |
|
| 42 | + protected function __log(string $level, string $message, array $context = []) { |
|
| 43 | 43 | |
| 44 | 44 | // TODO: $context, tests |
| 45 | 45 | $this->db->insert |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * |
| 20 | 20 | */ |
| 21 | -abstract class LogOutputAbstract implements LogOutputInterface{ |
|
| 21 | +abstract class LogOutputAbstract implements LogOutputInterface { |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * @var \chillerlan\Logger\LogOptions |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @param \chillerlan\Traits\ContainerInterface|null $options |
| 32 | 32 | */ |
| 33 | - public function __construct(ContainerInterface $options = null){ |
|
| 33 | + public function __construct(ContainerInterface $options = null) { |
|
| 34 | 34 | $this->options = $options ?? new LogOptions; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @inheritdoc |
| 39 | 39 | */ |
| 40 | - public function __destruct(){ |
|
| 40 | + public function __destruct() { |
|
| 41 | 41 | $this->close(); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * @inheritdoc |
| 62 | 62 | */ |
| 63 | - public function log(string $level, string $message, array $context = []){ // @todo: loglevel bitmask |
|
| 64 | - if((array_key_exists($level, $this::LEVELS) && $this::LEVELS[$level] >= $this::LEVELS[$this->options->minLogLevel]) || (!array_key_exists($level, $this::LEVELS) && !empty($level))){ |
|
| 63 | + public function log(string $level, string $message, array $context = []) { // @todo: loglevel bitmask |
|
| 64 | + if ((array_key_exists($level, $this::LEVELS) && $this::LEVELS[$level] >= $this::LEVELS[$this->options->minLogLevel]) || (!array_key_exists($level, $this::LEVELS) && !empty($level))) { |
|
| 65 | 65 | $this->__log($level, $message, $context); |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @return string |
| 75 | 75 | */ |
| 76 | - protected function message(string $level, string $message, array $context = null){ |
|
| 76 | + protected function message(string $level, string $message, array $context = null) { |
|
| 77 | 77 | return sprintf($this->options->consoleFormat, date($this->options->consoleDateFormat), $level, $message).PHP_EOL; |
| 78 | 78 | } |
| 79 | 79 | |