Completed
Push — Readme-gmail-change ( 92e7ac )
by
unknown
02:28
created

Logger::logException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 3
ccs 0
cts 3
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 2
1
<?php
2
3
/**
4
 * ownCloud - mail
5
 *
6
 * This file is licensed under the Affero General Public License version 3 or
7
 * later. See the COPYING file.
8
 *
9
 * @author Christoph Wurst <[email protected]>
10
 * @copyright Christoph Wurst 2015
11
 */
12
13
namespace OCA\Mail\Service;
14
15
use OCP\ILogger;
16
17
class Logger implements ILogger {
18
19
	/** @var array */
20
	private $context;
21
22
	/** @var ILogger */
23
	private $logger;
24
25
	/**
26
	 * 
27
	 * @param string $appName
28
	 * @param ILogger $logger
29
	 */
30 8
	public function __construct($appName, ILogger $logger) {
31 8
		$this->context = [
32 8
			'app' => $appName,
33
		];
34 8
		$this->logger = $logger;
35 8
	}
36
37
	/**
38
	 * @inheritdoc
39
	 */
40 1
	public function emergency($message, array $context = []) {
41 1
		$this->logger->emergency($message, array_merge($this->context, $context));
42 1
	}
43
44
	/**
45
	 * @inheritdoc
46
	 */
47 1
	public function alert($message, array $context = []) {
48 1
		$this->logger->alert($message, array_merge($this->context, $context));
49 1
	}
50
51
	/**
52
	 * @inheritdoc
53
	 */
54 1
	public function critical($message, array $context = []) {
55 1
		$this->logger->critical($message, array_merge($this->context, $context));
56 1
	}
57
58
	/**
59
	 * @inheritdoc
60
	 */
61 1
	public function error($message, array $context = []) {
62 1
		$this->logger->error($message, array_merge($this->context, $context));
63 1
	}
64
65
	/**
66
	 * @inheritdoc
67
	 */
68 1
	public function warning($message, array $context = []) {
69 1
		$this->logger->warning($message, array_merge($this->context, $context));
70 1
	}
71
72
	/**
73
	 * @inheritdoc
74
	 */
75 1
	public function notice($message, array $context = []) {
76 1
		$this->logger->notice($message, array_merge($this->context, $context));
77 1
	}
78
79
	/**
80
	 * @inheritdoc
81
	 */
82 1
	public function info($message, array $context = []) {
83 1
		$this->logger->info($message, array_merge($this->context, $context));
84 1
	}
85
86
	/**
87
	 * @inheritdoc
88
	 */
89 1
	public function debug($message, array $context = []) {
90 1
		$this->logger->debug($message, array_merge($this->context, $context));
91 1
	}
92
93
	/**
94
	 * @inheritdoc
95
	 */
96
	public function log($level, $message, array $context = array()) {
97
		$this->logger->log($level, $message, array_merge($this->context, $context));
98
	}
99
100
	/**
101
	 * @inheritdoc
102
	 */
103
	public function logException(\Exception $exception, array $context = array()) {
104
		$this->logger->logException($exception, array_merge($this->context, $context));
105
	}
106
107
}
108