|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @author Christoph Wurst <[email protected]> |
|
5
|
|
|
* @author Christoph Wurst <[email protected]> |
|
6
|
|
|
* @author Thomas Müller <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* Mail |
|
9
|
|
|
* |
|
10
|
|
|
* This code is free software: you can redistribute it and/or modify |
|
11
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
|
12
|
|
|
* as published by the Free Software Foundation. |
|
13
|
|
|
* |
|
14
|
|
|
* This program is distributed in the hope that it will be useful, |
|
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17
|
|
|
* GNU Affero General Public License for more details. |
|
18
|
|
|
* |
|
19
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
|
20
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
|
21
|
|
|
* |
|
22
|
|
|
*/ |
|
23
|
|
|
|
|
24
|
|
|
namespace OCA\Mail\Service; |
|
25
|
|
|
|
|
26
|
|
|
use OCP\ILogger; |
|
27
|
|
|
|
|
28
|
|
|
class Logger { |
|
29
|
|
|
|
|
30
|
|
|
/** @var array */ |
|
31
|
|
|
private $context; |
|
32
|
|
|
|
|
33
|
|
|
/** @var ILogger */ |
|
34
|
|
|
private $logger; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* |
|
38
|
|
|
* @param string $appName |
|
39
|
|
|
* @param ILogger $logger |
|
40
|
|
|
*/ |
|
41
|
9 |
|
public function __construct($appName, ILogger $logger) { |
|
42
|
9 |
|
$this->context = [ |
|
43
|
9 |
|
'app' => $appName, |
|
44
|
|
|
]; |
|
45
|
9 |
|
$this->logger = $logger; |
|
46
|
9 |
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @inheritdoc |
|
50
|
|
|
*/ |
|
51
|
1 |
|
public function emergency($message, array $context = []) { |
|
52
|
1 |
|
$this->logger->emergency($message, array_merge($this->context, $context)); |
|
53
|
1 |
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @inheritdoc |
|
57
|
|
|
*/ |
|
58
|
1 |
|
public function alert($message, array $context = []) { |
|
59
|
1 |
|
$this->logger->alert($message, array_merge($this->context, $context)); |
|
60
|
1 |
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @inheritdoc |
|
64
|
|
|
*/ |
|
65
|
1 |
|
public function critical($message, array $context = []) { |
|
66
|
1 |
|
$this->logger->critical($message, array_merge($this->context, $context)); |
|
67
|
1 |
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @inheritdoc |
|
71
|
|
|
*/ |
|
72
|
1 |
|
public function error($message, array $context = []) { |
|
73
|
1 |
|
$this->logger->error($message, array_merge($this->context, $context)); |
|
74
|
1 |
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @inheritdoc |
|
78
|
|
|
*/ |
|
79
|
1 |
|
public function warning($message, array $context = []) { |
|
80
|
1 |
|
$this->logger->warning($message, array_merge($this->context, $context)); |
|
81
|
1 |
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @inheritdoc |
|
85
|
|
|
*/ |
|
86
|
1 |
|
public function notice($message, array $context = []) { |
|
87
|
1 |
|
$this->logger->notice($message, array_merge($this->context, $context)); |
|
88
|
1 |
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @inheritdoc |
|
92
|
|
|
*/ |
|
93
|
1 |
|
public function info($message, array $context = []) { |
|
94
|
1 |
|
$this->logger->info($message, array_merge($this->context, $context)); |
|
95
|
1 |
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @inheritdoc |
|
99
|
|
|
*/ |
|
100
|
1 |
|
public function debug($message, array $context = []) { |
|
101
|
1 |
|
$this->logger->debug($message, array_merge($this->context, $context)); |
|
102
|
1 |
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @inheritdoc |
|
106
|
|
|
*/ |
|
107
|
|
|
public function log($level, $message, array $context = []) { |
|
108
|
|
|
$this->logger->log($level, $message, array_merge($this->context, $context)); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* @inheritdoc |
|
113
|
|
|
*/ |
|
114
|
1 |
|
public function logException($exception, array $context = []) { |
|
115
|
1 |
|
$this->logger->logException($exception, array_merge($this->context, $context)); |
|
116
|
1 |
|
} |
|
117
|
|
|
|
|
118
|
|
|
} |
|
119
|
|
|
|