1 | <?php |
||
33 | abstract class HandlerAbstract extends ObjectAbstract implements HandlerInterface |
||
34 | { |
||
35 | use FormatterAwareTrait; |
||
36 | |||
37 | /** |
||
38 | * Stop log propagation after this handler ? |
||
39 | * |
||
40 | * @var bool |
||
41 | * @access protected |
||
42 | */ |
||
43 | protected $stop; |
||
44 | |||
45 | /** |
||
46 | * Created with level handling |
||
47 | * |
||
48 | * @param FormatterInterface $formatter if any |
||
49 | * @param bool $stopPropagation if u want to |
||
50 | * @access public |
||
51 | * @since 2.0.1 removed level param |
||
52 | */ |
||
53 | public function __construct( |
||
60 | |||
61 | /** |
||
62 | * {@inheritdoc} |
||
63 | */ |
||
64 | public function __invoke(LogEntryInterface $logEntry) |
||
79 | |||
80 | /** |
||
81 | * Destructor |
||
82 | * |
||
83 | * @access public |
||
84 | */ |
||
85 | public function __destruct() |
||
89 | |||
90 | /** |
||
91 | * Write to handler's device |
||
92 | * |
||
93 | * @param LogEntryInterface $logEntry |
||
94 | * @access protected |
||
95 | */ |
||
96 | abstract protected function write(LogEntryInterface $logEntry); |
||
97 | |||
98 | /** |
||
99 | * Is this handler handling this log ? |
||
100 | * |
||
101 | * To be overriden by child classes |
||
102 | * |
||
103 | * @param LogEntryInterface $logEntry |
||
104 | * @return bool |
||
105 | * @access protected |
||
106 | */ |
||
107 | protected function isHandling(LogEntryInterface $logEntry)/*# : bool */ |
||
111 | |||
112 | /** |
||
113 | * Close the handler, to be overriden by child classes |
||
114 | * |
||
115 | * @access protected |
||
116 | */ |
||
117 | protected function close() |
||
120 | |||
121 | /** |
||
122 | * Get EOL char base on the platform WIN or UNIX |
||
123 | * |
||
124 | * @return string |
||
125 | * @access protected |
||
126 | */ |
||
127 | protected function getEol()/*# : string */ |
||
135 | |||
136 | /** |
||
137 | * Test to see if in CLI mode |
||
138 | * |
||
139 | * @return bool |
||
140 | * @access protected |
||
141 | */ |
||
142 | protected function isCliMode()/*# : bool */ |
||
146 | } |
||
147 |