Total Complexity | 4 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | abstract class AbstractFileLogger extends AbstractLogger |
||
10 | { |
||
11 | protected string $channel; |
||
12 | protected string $logDir; |
||
13 | protected string $logPath; |
||
14 | |||
15 | public function __construct(string $channel, string $logDir) |
||
16 | { |
||
17 | $this->channel = $channel; |
||
18 | $this->logDir = $logDir; |
||
19 | |||
20 | if (empty($this->logDir)) { |
||
21 | throw new LoggerException(\sprintf('Log directory not set for channel "%s".', $channel)); |
||
22 | } |
||
23 | |||
24 | if (!\is_writable($this->logDir)) { |
||
25 | throw new LoggerException(\sprintf('Log directory not writeable: %s.', $this->logDir)); |
||
26 | } |
||
27 | $this->logPath = \sprintf('%s%s.log', $this->logDir, $this->channel); |
||
28 | } |
||
29 | |||
30 | public function clear(): bool |
||
33 | } |
||
34 | } |
||
35 |