1 | <?php |
||
21 | class LogfileHandler extends StreamHandler |
||
22 | { |
||
23 | /** |
||
24 | * file rotation type |
||
25 | * |
||
26 | * @const int |
||
27 | */ |
||
28 | const ROTATE_NONE = 0; // do not rotate |
||
29 | const ROTATE_DATE = 1; // rotate by date |
||
30 | |||
31 | /** |
||
32 | * Constructor |
||
33 | * |
||
34 | * @param string $path full path |
||
35 | * @param FormatterInterface $formatter |
||
36 | * @param int $rotate rotate type |
||
37 | * @throws \LogicException if path not writable |
||
38 | */ |
||
39 | public function __construct( |
||
50 | |||
51 | /** |
||
52 | * Check file path |
||
53 | * |
||
54 | * @param string $path |
||
55 | * @throws \LogicException if directory failure etc. |
||
56 | */ |
||
57 | protected function checkPath(string $path) |
||
71 | |||
72 | /** |
||
73 | * Rotate file on start |
||
74 | * |
||
75 | * @param string $path |
||
76 | * @param int $type |
||
77 | * @return bool |
||
78 | */ |
||
79 | protected function doRotation(string $path, int $type): bool |
||
90 | |||
91 | /** |
||
92 | * Rotate $path to $path_20160616 |
||
93 | * |
||
94 | * @param string $path |
||
95 | * @param string $format date format |
||
96 | * @return bool |
||
97 | */ |
||
98 | protected function rotateByDate(string $path, string $format = 'Ymd'): bool |
||
107 | } |