Total Complexity | 10 |
Total Lines | 64 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | trait LogTrait |
||
8 | { |
||
9 | public function logException(\Exception $e) |
||
10 | { |
||
11 | $this->log( |
||
12 | sprintf( |
||
13 | 'Uncaught exception \'%s\': [%d]%s called in %s:%d%s%s', |
||
14 | get_class($e), |
||
15 | $e->getCode(), |
||
16 | $e->getMessage(), |
||
17 | $e->getFile(), |
||
18 | $e->getLine(), |
||
19 | PHP_EOL, |
||
20 | $e->getTraceAsString() |
||
21 | ), |
||
22 | 'ERROR' |
||
23 | ); |
||
24 | } |
||
25 | |||
26 | public function log($msg, $type = 'INFO') |
||
45 | } |
||
46 | } |
||
47 | |||
48 | public function info($msg) |
||
49 | { |
||
50 | $this->log($msg, 'INFO'); |
||
51 | } |
||
52 | |||
53 | public function warning($msg) |
||
56 | } |
||
57 | |||
58 | public function error($msg) |
||
61 | } |
||
62 | |||
63 | |||
64 | public function callWithCatchException(callable $callback) |
||
71 | } |
||
72 | } |
||
73 | } |