Passed
Push — master ( b1ca74...11e228 )
by Christoph
60:05 queued 47:35
created
apps/workflowengine/lib/Service/Logger.php 2 patches
Indentation   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -34,143 +34,143 @@
 block discarded – undo
34 34
 use Psr\Log\LoggerInterface;
35 35
 
36 36
 class Logger {
37
-	/** @var ILogger */
38
-	protected $generalLogger;
39
-	/** @var LoggerInterface */
40
-	protected $flowLogger;
41
-	/** @var IConfig */
42
-	private $config;
43
-	/** @var ILogFactory */
44
-	private $logFactory;
37
+    /** @var ILogger */
38
+    protected $generalLogger;
39
+    /** @var LoggerInterface */
40
+    protected $flowLogger;
41
+    /** @var IConfig */
42
+    private $config;
43
+    /** @var ILogFactory */
44
+    private $logFactory;
45 45
 
46
-	public function __construct(ILogger $generalLogger, IConfig $config, ILogFactory $logFactory) {
47
-		$this->generalLogger = $generalLogger;
48
-		$this->config = $config;
49
-		$this->logFactory = $logFactory;
46
+    public function __construct(ILogger $generalLogger, IConfig $config, ILogFactory $logFactory) {
47
+        $this->generalLogger = $generalLogger;
48
+        $this->config = $config;
49
+        $this->logFactory = $logFactory;
50 50
 
51
-		$this->initLogger();
52
-	}
51
+        $this->initLogger();
52
+    }
53 53
 
54
-	protected function initLogger() {
55
-		$default = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/flow.log';
56
-		$logFile = trim((string)$this->config->getAppValue(Application::APP_ID, 'logfile', $default));
57
-		if ($logFile !== '') {
58
-			$this->flowLogger = $this->logFactory->getCustomPsrLogger($logFile);
59
-		}
60
-	}
61
-
62
-	public function logFlowRequests(LogContext $logContext) {
63
-		$message = 'Flow activation: rules were requested for operation {op}';
64
-		$context = ['op' => $logContext->getDetails()['operation']['name'], 'level' => ILogger::DEBUG];
65
-
66
-		$logContext->setDescription('Flow activation: rules were requested');
67
-
68
-		$this->log($message, $context, $logContext);
69
-	}
70
-
71
-	public function logScopeExpansion(LogContext $logContext) {
72
-		$message = 'Flow rule of a different user is legit for operation {op}';
73
-		$context = ['op' => $logContext->getDetails()['operation']['name']];
74
-
75
-		$logContext->setDescription('Flow rule of a different user is legit');
76
-
77
-		$this->log($message, $context, $logContext);
78
-	}
79
-
80
-	public function logPassedCheck(LogContext $logContext) {
81
-		$message = 'Flow rule qualified to run {op}, config: {config}';
82
-		$context = [
83
-			'op' => $logContext->getDetails()['operation']['name'],
84
-			'config' => $logContext->getDetails()['configuration'],
85
-			'level' => ILogger::DEBUG,
86
-		];
87
-
88
-		$logContext->setDescription('Flow rule qualified to run');
89
-
90
-		$this->log($message, $context, $logContext);
91
-	}
92
-
93
-	public function logRunSingle(LogContext $logContext) {
94
-		$message = 'Last qualified flow configuration is going to run {op}';
95
-		$context = [
96
-			'op' => $logContext->getDetails()['operation']['name'],
97
-		];
98
-
99
-		$logContext->setDescription('Last qualified flow configuration is going to run');
100
-
101
-		$this->log($message, $context, $logContext);
102
-	}
103
-
104
-	public function logRunAll(LogContext $logContext) {
105
-		$message = 'All qualified flow configurations are going to run {op}';
106
-		$context = [
107
-			'op' => $logContext->getDetails()['operation']['name'],
108
-		];
109
-
110
-		$logContext->setDescription('All qualified flow configurations are going to run');
111
-
112
-		$this->log($message, $context, $logContext);
113
-	}
114
-
115
-	public function logRunNone(LogContext $logContext) {
116
-		$message = 'No flow configurations is going to run {op}';
117
-		$context = [
118
-			'op' => $logContext->getDetails()['operation']['name'],
119
-			'level' => ILogger::DEBUG,
120
-		];
121
-
122
-		$logContext->setDescription('No flow configurations is going to run');
123
-
124
-		$this->log($message, $context, $logContext);
125
-	}
126
-
127
-	public function logEventInit(LogContext $logContext) {
128
-		$message = 'Flow activated by event {ev}';
129
-
130
-		$context = [
131
-			'ev' => $logContext->getDetails()['eventName'],
132
-			'level' => ILogger::DEBUG,
133
-		];
134
-
135
-		$logContext->setDescription('Flow activated by event');
136
-
137
-		$this->log($message, $context, $logContext);
138
-	}
139
-
140
-	public function logEventDone(LogContext $logContext) {
141
-		$message = 'Flow handling done for event {ev}';
142
-
143
-		$context = [
144
-			'ev' => $logContext->getDetails()['eventName'],
145
-		];
146
-
147
-		$logContext->setDescription('Flow handling for event done');
148
-
149
-		$this->log($message, $context, $logContext);
150
-	}
151
-
152
-	protected function log(
153
-		string $message,
154
-		array $context,
155
-		LogContext $logContext
156
-	): void {
157
-		if (!isset($context['app'])) {
158
-			$context['app'] = Application::APP_ID;
159
-		}
160
-		if (!isset($context['level'])) {
161
-			$context['level'] = ILogger::INFO;
162
-		}
163
-		$this->generalLogger->log($context['level'], $message, $context);
54
+    protected function initLogger() {
55
+        $default = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/flow.log';
56
+        $logFile = trim((string)$this->config->getAppValue(Application::APP_ID, 'logfile', $default));
57
+        if ($logFile !== '') {
58
+            $this->flowLogger = $this->logFactory->getCustomPsrLogger($logFile);
59
+        }
60
+    }
61
+
62
+    public function logFlowRequests(LogContext $logContext) {
63
+        $message = 'Flow activation: rules were requested for operation {op}';
64
+        $context = ['op' => $logContext->getDetails()['operation']['name'], 'level' => ILogger::DEBUG];
65
+
66
+        $logContext->setDescription('Flow activation: rules were requested');
67
+
68
+        $this->log($message, $context, $logContext);
69
+    }
70
+
71
+    public function logScopeExpansion(LogContext $logContext) {
72
+        $message = 'Flow rule of a different user is legit for operation {op}';
73
+        $context = ['op' => $logContext->getDetails()['operation']['name']];
74
+
75
+        $logContext->setDescription('Flow rule of a different user is legit');
76
+
77
+        $this->log($message, $context, $logContext);
78
+    }
79
+
80
+    public function logPassedCheck(LogContext $logContext) {
81
+        $message = 'Flow rule qualified to run {op}, config: {config}';
82
+        $context = [
83
+            'op' => $logContext->getDetails()['operation']['name'],
84
+            'config' => $logContext->getDetails()['configuration'],
85
+            'level' => ILogger::DEBUG,
86
+        ];
87
+
88
+        $logContext->setDescription('Flow rule qualified to run');
89
+
90
+        $this->log($message, $context, $logContext);
91
+    }
92
+
93
+    public function logRunSingle(LogContext $logContext) {
94
+        $message = 'Last qualified flow configuration is going to run {op}';
95
+        $context = [
96
+            'op' => $logContext->getDetails()['operation']['name'],
97
+        ];
98
+
99
+        $logContext->setDescription('Last qualified flow configuration is going to run');
100
+
101
+        $this->log($message, $context, $logContext);
102
+    }
103
+
104
+    public function logRunAll(LogContext $logContext) {
105
+        $message = 'All qualified flow configurations are going to run {op}';
106
+        $context = [
107
+            'op' => $logContext->getDetails()['operation']['name'],
108
+        ];
109
+
110
+        $logContext->setDescription('All qualified flow configurations are going to run');
111
+
112
+        $this->log($message, $context, $logContext);
113
+    }
114
+
115
+    public function logRunNone(LogContext $logContext) {
116
+        $message = 'No flow configurations is going to run {op}';
117
+        $context = [
118
+            'op' => $logContext->getDetails()['operation']['name'],
119
+            'level' => ILogger::DEBUG,
120
+        ];
121
+
122
+        $logContext->setDescription('No flow configurations is going to run');
123
+
124
+        $this->log($message, $context, $logContext);
125
+    }
126
+
127
+    public function logEventInit(LogContext $logContext) {
128
+        $message = 'Flow activated by event {ev}';
129
+
130
+        $context = [
131
+            'ev' => $logContext->getDetails()['eventName'],
132
+            'level' => ILogger::DEBUG,
133
+        ];
134
+
135
+        $logContext->setDescription('Flow activated by event');
136
+
137
+        $this->log($message, $context, $logContext);
138
+    }
139
+
140
+    public function logEventDone(LogContext $logContext) {
141
+        $message = 'Flow handling done for event {ev}';
142
+
143
+        $context = [
144
+            'ev' => $logContext->getDetails()['eventName'],
145
+        ];
146
+
147
+        $logContext->setDescription('Flow handling for event done');
148
+
149
+        $this->log($message, $context, $logContext);
150
+    }
151
+
152
+    protected function log(
153
+        string $message,
154
+        array $context,
155
+        LogContext $logContext
156
+    ): void {
157
+        if (!isset($context['app'])) {
158
+            $context['app'] = Application::APP_ID;
159
+        }
160
+        if (!isset($context['level'])) {
161
+            $context['level'] = ILogger::INFO;
162
+        }
163
+        $this->generalLogger->log($context['level'], $message, $context);
164 164
 
165
-		if (!$this->flowLogger instanceof IDataLogger) {
166
-			return;
167
-		}
168
-
169
-		$details = $logContext->getDetails();
170
-		$this->flowLogger->logData(
171
-			$details['message'],
172
-			$details,
173
-			['app' => Application::APP_ID, 'level' => $context['level']]
174
-		);
175
-	}
165
+        if (!$this->flowLogger instanceof IDataLogger) {
166
+            return;
167
+        }
168
+
169
+        $details = $logContext->getDetails();
170
+        $this->flowLogger->logData(
171
+            $details['message'],
172
+            $details,
173
+            ['app' => Application::APP_ID, 'level' => $context['level']]
174
+        );
175
+    }
176 176
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,8 +52,8 @@
 block discarded – undo
52 52
 	}
53 53
 
54 54
 	protected function initLogger() {
55
-		$default = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') . '/flow.log';
56
-		$logFile = trim((string)$this->config->getAppValue(Application::APP_ID, 'logfile', $default));
55
+		$default = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data').'/flow.log';
56
+		$logFile = trim((string) $this->config->getAppValue(Application::APP_ID, 'logfile', $default));
57 57
 		if ($logFile !== '') {
58 58
 			$this->flowLogger = $this->logFactory->getCustomPsrLogger($logFile);
59 59
 		}
Please login to merge, or discard this patch.
lib/public/Log/ILogFactory.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -33,26 +33,26 @@
 block discarded – undo
33 33
  * @since 14.0.0
34 34
  */
35 35
 interface ILogFactory {
36
-	/**
37
-	 * @param string $type - one of: file, errorlog, syslog, systemd
38
-	 * @return IWriter
39
-	 * @since 14.0.0
40
-	 */
41
-	public function get(string $type): IWriter;
36
+    /**
37
+     * @param string $type - one of: file, errorlog, syslog, systemd
38
+     * @return IWriter
39
+     * @since 14.0.0
40
+     */
41
+    public function get(string $type): IWriter;
42 42
 
43
-	/**
44
-	 * @param string $path
45
-	 * @return ILogger
46
-	 * @since 14.0.0
47
-	 * @deprecated use \OCP\Log\ILogFactory::getCustomPsrLogger
48
-	 * @see \OCP\Log\ILogFactory::getCustomPsrLogger
49
-	 */
50
-	public function getCustomLogger(string $path): ILogger;
43
+    /**
44
+     * @param string $path
45
+     * @return ILogger
46
+     * @since 14.0.0
47
+     * @deprecated use \OCP\Log\ILogFactory::getCustomPsrLogger
48
+     * @see \OCP\Log\ILogFactory::getCustomPsrLogger
49
+     */
50
+    public function getCustomLogger(string $path): ILogger;
51 51
 
52
-	/**
53
-	 * @param string $path
54
-	 * @return LoggerInterface
55
-	 * @since 22.0.0
56
-	 */
57
-	public function getCustomPsrLogger(string $path): LoggerInterface;
52
+    /**
53
+     * @param string $path
54
+     * @return LoggerInterface
55
+     * @since 22.0.0
56
+     */
57
+    public function getCustomPsrLogger(string $path): LoggerInterface;
58 58
 }
Please login to merge, or discard this patch.
lib/private/Log/LogFactory.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -34,57 +34,57 @@
 block discarded – undo
34 34
 use Psr\Log\LoggerInterface;
35 35
 
36 36
 class LogFactory implements ILogFactory {
37
-	/** @var IServerContainer */
38
-	private $c;
39
-	/** @var SystemConfig */
40
-	private $systemConfig;
37
+    /** @var IServerContainer */
38
+    private $c;
39
+    /** @var SystemConfig */
40
+    private $systemConfig;
41 41
 
42
-	public function __construct(IServerContainer $c, SystemConfig $systemConfig) {
43
-		$this->c = $c;
44
-		$this->systemConfig = $systemConfig;
45
-	}
42
+    public function __construct(IServerContainer $c, SystemConfig $systemConfig) {
43
+        $this->c = $c;
44
+        $this->systemConfig = $systemConfig;
45
+    }
46 46
 
47
-	/**
48
-	 * @throws \OCP\AppFramework\QueryException
49
-	 */
50
-	public function get(string $type):IWriter {
51
-		switch (strtolower($type)) {
52
-			case 'errorlog':
53
-				return new Errorlog();
54
-			case 'syslog':
55
-				return $this->c->resolve(Syslog::class);
56
-			case 'systemd':
57
-				return $this->c->resolve(Systemdlog::class);
58
-			case 'file':
59
-				return $this->buildLogFile();
47
+    /**
48
+     * @throws \OCP\AppFramework\QueryException
49
+     */
50
+    public function get(string $type):IWriter {
51
+        switch (strtolower($type)) {
52
+            case 'errorlog':
53
+                return new Errorlog();
54
+            case 'syslog':
55
+                return $this->c->resolve(Syslog::class);
56
+            case 'systemd':
57
+                return $this->c->resolve(Systemdlog::class);
58
+            case 'file':
59
+                return $this->buildLogFile();
60 60
 
61
-			// Backwards compatibility for old and fallback for unknown log types
62
-			case 'owncloud':
63
-			case 'nextcloud':
64
-			default:
65
-				return $this->buildLogFile();
66
-		}
67
-	}
61
+            // Backwards compatibility for old and fallback for unknown log types
62
+            case 'owncloud':
63
+            case 'nextcloud':
64
+            default:
65
+                return $this->buildLogFile();
66
+        }
67
+    }
68 68
 
69
-	public function getCustomLogger(string $path):ILogger {
70
-		$log = $this->buildLogFile($path);
71
-		return new Log($log, $this->systemConfig);
72
-	}
69
+    public function getCustomLogger(string $path):ILogger {
70
+        $log = $this->buildLogFile($path);
71
+        return new Log($log, $this->systemConfig);
72
+    }
73 73
 
74
-	public function getCustomPsrLogger(string $path): LoggerInterface {
75
-		$log = $this->buildLogFile($path);
76
-		return new PsrLoggerAdapter(
77
-			new Log($log, $this->systemConfig)
78
-		);
79
-	}
74
+    public function getCustomPsrLogger(string $path): LoggerInterface {
75
+        $log = $this->buildLogFile($path);
76
+        return new PsrLoggerAdapter(
77
+            new Log($log, $this->systemConfig)
78
+        );
79
+    }
80 80
 
81
-	protected function buildLogFile(string $logFile = ''):File {
82
-		$defaultLogFile = $this->systemConfig->getValue('datadirectory', \OC::$SERVERROOT.'/data').'/nextcloud.log';
83
-		if ($logFile === '') {
84
-			$logFile = $this->systemConfig->getValue('logfile', $defaultLogFile);
85
-		}
86
-		$fallback = $defaultLogFile !== $logFile ? $defaultLogFile : '';
81
+    protected function buildLogFile(string $logFile = ''):File {
82
+        $defaultLogFile = $this->systemConfig->getValue('datadirectory', \OC::$SERVERROOT.'/data').'/nextcloud.log';
83
+        if ($logFile === '') {
84
+            $logFile = $this->systemConfig->getValue('logfile', $defaultLogFile);
85
+        }
86
+        $fallback = $defaultLogFile !== $logFile ? $defaultLogFile : '';
87 87
 
88
-		return new File($logFile, $fallback, $this->systemConfig);
89
-	}
88
+        return new File($logFile, $fallback, $this->systemConfig);
89
+    }
90 90
 }
Please login to merge, or discard this patch.
lib/private/Log/PsrLoggerAdapter.php 1 patch
Indentation   +217 added lines, -217 removed lines patch added patch discarded remove patch
@@ -37,233 +37,233 @@
 block discarded – undo
37 37
 
38 38
 final class PsrLoggerAdapter implements LoggerInterface, IDataLogger {
39 39
 
40
-	/** @var Log */
41
-	private $logger;
40
+    /** @var Log */
41
+    private $logger;
42 42
 
43
-	public function __construct(Log $logger) {
44
-		$this->logger = $logger;
45
-	}
43
+    public function __construct(Log $logger) {
44
+        $this->logger = $logger;
45
+    }
46 46
 
47
-	private function containsThrowable(array $context): bool {
48
-		return array_key_exists('exception', $context) && $context['exception'] instanceof Throwable;
49
-	}
47
+    private function containsThrowable(array $context): bool {
48
+        return array_key_exists('exception', $context) && $context['exception'] instanceof Throwable;
49
+    }
50 50
 
51
-	/**
52
-	 * System is unusable.
53
-	 *
54
-	 * @param string $message
55
-	 * @param array $context
56
-	 *
57
-	 * @return void
58
-	 */
59
-	public function emergency($message, array $context = []): void {
60
-		if ($this->containsThrowable($context)) {
61
-			$this->logger->logException($context['exception'], array_merge(
62
-				[
63
-					'message' => $message,
64
-					'level' => ILogger::FATAL,
65
-				],
66
-				$context
67
-			));
68
-		} else {
69
-			$this->logger->emergency($message, $context);
70
-		}
71
-	}
51
+    /**
52
+     * System is unusable.
53
+     *
54
+     * @param string $message
55
+     * @param array $context
56
+     *
57
+     * @return void
58
+     */
59
+    public function emergency($message, array $context = []): void {
60
+        if ($this->containsThrowable($context)) {
61
+            $this->logger->logException($context['exception'], array_merge(
62
+                [
63
+                    'message' => $message,
64
+                    'level' => ILogger::FATAL,
65
+                ],
66
+                $context
67
+            ));
68
+        } else {
69
+            $this->logger->emergency($message, $context);
70
+        }
71
+    }
72 72
 
73
-	/**
74
-	 * Action must be taken immediately.
75
-	 *
76
-	 * Example: Entire website down, database unavailable, etc. This should
77
-	 * trigger the SMS alerts and wake you up.
78
-	 *
79
-	 * @param string $message
80
-	 * @param array $context
81
-	 *
82
-	 * @return void
83
-	 */
84
-	public function alert($message, array $context = []) {
85
-		if ($this->containsThrowable($context)) {
86
-			$this->logger->logException($context['exception'], array_merge(
87
-				[
88
-					'message' => $message,
89
-					'level' => ILogger::ERROR,
90
-				],
91
-				$context
92
-			));
93
-		} else {
94
-			$this->logger->alert($message, $context);
95
-		}
96
-	}
73
+    /**
74
+     * Action must be taken immediately.
75
+     *
76
+     * Example: Entire website down, database unavailable, etc. This should
77
+     * trigger the SMS alerts and wake you up.
78
+     *
79
+     * @param string $message
80
+     * @param array $context
81
+     *
82
+     * @return void
83
+     */
84
+    public function alert($message, array $context = []) {
85
+        if ($this->containsThrowable($context)) {
86
+            $this->logger->logException($context['exception'], array_merge(
87
+                [
88
+                    'message' => $message,
89
+                    'level' => ILogger::ERROR,
90
+                ],
91
+                $context
92
+            ));
93
+        } else {
94
+            $this->logger->alert($message, $context);
95
+        }
96
+    }
97 97
 
98
-	/**
99
-	 * Critical conditions.
100
-	 *
101
-	 * Example: Application component unavailable, unexpected exception.
102
-	 *
103
-	 * @param string $message
104
-	 * @param array $context
105
-	 *
106
-	 * @return void
107
-	 */
108
-	public function critical($message, array $context = []) {
109
-		if ($this->containsThrowable($context)) {
110
-			$this->logger->logException($context['exception'], array_merge(
111
-				[
112
-					'message' => $message,
113
-					'level' => ILogger::ERROR,
114
-				],
115
-				$context
116
-			));
117
-		} else {
118
-			$this->logger->critical($message, $context);
119
-		}
120
-	}
98
+    /**
99
+     * Critical conditions.
100
+     *
101
+     * Example: Application component unavailable, unexpected exception.
102
+     *
103
+     * @param string $message
104
+     * @param array $context
105
+     *
106
+     * @return void
107
+     */
108
+    public function critical($message, array $context = []) {
109
+        if ($this->containsThrowable($context)) {
110
+            $this->logger->logException($context['exception'], array_merge(
111
+                [
112
+                    'message' => $message,
113
+                    'level' => ILogger::ERROR,
114
+                ],
115
+                $context
116
+            ));
117
+        } else {
118
+            $this->logger->critical($message, $context);
119
+        }
120
+    }
121 121
 
122
-	/**
123
-	 * Runtime errors that do not require immediate action but should typically
124
-	 * be logged and monitored.
125
-	 *
126
-	 * @param string $message
127
-	 * @param array $context
128
-	 *
129
-	 * @return void
130
-	 */
131
-	public function error($message, array $context = []) {
132
-		if ($this->containsThrowable($context)) {
133
-			$this->logger->logException($context['exception'], array_merge(
134
-				[
135
-					'message' => $message,
136
-					'level' => ILogger::ERROR,
137
-				],
138
-				$context
139
-			));
140
-		} else {
141
-			$this->logger->error($message, $context);
142
-		}
143
-	}
122
+    /**
123
+     * Runtime errors that do not require immediate action but should typically
124
+     * be logged and monitored.
125
+     *
126
+     * @param string $message
127
+     * @param array $context
128
+     *
129
+     * @return void
130
+     */
131
+    public function error($message, array $context = []) {
132
+        if ($this->containsThrowable($context)) {
133
+            $this->logger->logException($context['exception'], array_merge(
134
+                [
135
+                    'message' => $message,
136
+                    'level' => ILogger::ERROR,
137
+                ],
138
+                $context
139
+            ));
140
+        } else {
141
+            $this->logger->error($message, $context);
142
+        }
143
+    }
144 144
 
145
-	/**
146
-	 * Exceptional occurrences that are not errors.
147
-	 *
148
-	 * Example: Use of deprecated APIs, poor use of an API, undesirable things
149
-	 * that are not necessarily wrong.
150
-	 *
151
-	 * @param string $message
152
-	 * @param array $context
153
-	 *
154
-	 * @return void
155
-	 */
156
-	public function warning($message, array $context = []) {
157
-		if ($this->containsThrowable($context)) {
158
-			$this->logger->logException($context['exception'], array_merge(
159
-				[
160
-					'message' => $message,
161
-					'level' => ILogger::WARN,
162
-				],
163
-				$context
164
-			));
165
-		} else {
166
-			$this->logger->warning($message, $context);
167
-		}
168
-	}
145
+    /**
146
+     * Exceptional occurrences that are not errors.
147
+     *
148
+     * Example: Use of deprecated APIs, poor use of an API, undesirable things
149
+     * that are not necessarily wrong.
150
+     *
151
+     * @param string $message
152
+     * @param array $context
153
+     *
154
+     * @return void
155
+     */
156
+    public function warning($message, array $context = []) {
157
+        if ($this->containsThrowable($context)) {
158
+            $this->logger->logException($context['exception'], array_merge(
159
+                [
160
+                    'message' => $message,
161
+                    'level' => ILogger::WARN,
162
+                ],
163
+                $context
164
+            ));
165
+        } else {
166
+            $this->logger->warning($message, $context);
167
+        }
168
+    }
169 169
 
170
-	/**
171
-	 * Normal but significant events.
172
-	 *
173
-	 * @param string $message
174
-	 * @param array $context
175
-	 *
176
-	 * @return void
177
-	 */
178
-	public function notice($message, array $context = []) {
179
-		if ($this->containsThrowable($context)) {
180
-			$this->logger->logException($context['exception'], array_merge(
181
-				[
182
-					'message' => $message,
183
-					'level' => ILogger::INFO,
184
-				],
185
-				$context
186
-			));
187
-		} else {
188
-			$this->logger->notice($message, $context);
189
-		}
190
-	}
170
+    /**
171
+     * Normal but significant events.
172
+     *
173
+     * @param string $message
174
+     * @param array $context
175
+     *
176
+     * @return void
177
+     */
178
+    public function notice($message, array $context = []) {
179
+        if ($this->containsThrowable($context)) {
180
+            $this->logger->logException($context['exception'], array_merge(
181
+                [
182
+                    'message' => $message,
183
+                    'level' => ILogger::INFO,
184
+                ],
185
+                $context
186
+            ));
187
+        } else {
188
+            $this->logger->notice($message, $context);
189
+        }
190
+    }
191 191
 
192
-	/**
193
-	 * Interesting events.
194
-	 *
195
-	 * Example: User logs in, SQL logs.
196
-	 *
197
-	 * @param string $message
198
-	 * @param array $context
199
-	 *
200
-	 * @return void
201
-	 */
202
-	public function info($message, array $context = []) {
203
-		if ($this->containsThrowable($context)) {
204
-			$this->logger->logException($context['exception'], array_merge(
205
-				[
206
-					'message' => $message,
207
-					'level' => ILogger::INFO,
208
-				],
209
-				$context
210
-			));
211
-		} else {
212
-			$this->logger->info($message, $context);
213
-		}
214
-	}
192
+    /**
193
+     * Interesting events.
194
+     *
195
+     * Example: User logs in, SQL logs.
196
+     *
197
+     * @param string $message
198
+     * @param array $context
199
+     *
200
+     * @return void
201
+     */
202
+    public function info($message, array $context = []) {
203
+        if ($this->containsThrowable($context)) {
204
+            $this->logger->logException($context['exception'], array_merge(
205
+                [
206
+                    'message' => $message,
207
+                    'level' => ILogger::INFO,
208
+                ],
209
+                $context
210
+            ));
211
+        } else {
212
+            $this->logger->info($message, $context);
213
+        }
214
+    }
215 215
 
216
-	/**
217
-	 * Detailed debug information.
218
-	 *
219
-	 * @param string $message
220
-	 * @param array $context
221
-	 *
222
-	 * @return void
223
-	 */
224
-	public function debug($message, array $context = []) {
225
-		if ($this->containsThrowable($context)) {
226
-			$this->logger->logException($context['exception'], array_merge(
227
-				[
228
-					'message' => $message,
229
-					'level' => ILogger::DEBUG,
230
-				],
231
-				$context
232
-			));
233
-		} else {
234
-			$this->logger->debug($message, $context);
235
-		}
236
-	}
216
+    /**
217
+     * Detailed debug information.
218
+     *
219
+     * @param string $message
220
+     * @param array $context
221
+     *
222
+     * @return void
223
+     */
224
+    public function debug($message, array $context = []) {
225
+        if ($this->containsThrowable($context)) {
226
+            $this->logger->logException($context['exception'], array_merge(
227
+                [
228
+                    'message' => $message,
229
+                    'level' => ILogger::DEBUG,
230
+                ],
231
+                $context
232
+            ));
233
+        } else {
234
+            $this->logger->debug($message, $context);
235
+        }
236
+    }
237 237
 
238
-	/**
239
-	 * Logs with an arbitrary level.
240
-	 *
241
-	 * @param mixed $level
242
-	 * @param string $message
243
-	 * @param array $context
244
-	 *
245
-	 * @return void
246
-	 *
247
-	 * @throws InvalidArgumentException
248
-	 */
249
-	public function log($level, $message, array $context = []) {
250
-		if (!is_int($level) || $level < ILogger::DEBUG || $level > ILogger::FATAL) {
251
-			throw new InvalidArgumentException('Nextcloud allows only integer log levels');
252
-		}
253
-		if ($this->containsThrowable($context)) {
254
-			$this->logger->logException($context['exception'], array_merge(
255
-				[
256
-					'message' => $message,
257
-					'level' => $level,
258
-				],
259
-				$context
260
-			));
261
-		} else {
262
-			$this->logger->log($level, $message, $context);
263
-		}
264
-	}
238
+    /**
239
+     * Logs with an arbitrary level.
240
+     *
241
+     * @param mixed $level
242
+     * @param string $message
243
+     * @param array $context
244
+     *
245
+     * @return void
246
+     *
247
+     * @throws InvalidArgumentException
248
+     */
249
+    public function log($level, $message, array $context = []) {
250
+        if (!is_int($level) || $level < ILogger::DEBUG || $level > ILogger::FATAL) {
251
+            throw new InvalidArgumentException('Nextcloud allows only integer log levels');
252
+        }
253
+        if ($this->containsThrowable($context)) {
254
+            $this->logger->logException($context['exception'], array_merge(
255
+                [
256
+                    'message' => $message,
257
+                    'level' => $level,
258
+                ],
259
+                $context
260
+            ));
261
+        } else {
262
+            $this->logger->log($level, $message, $context);
263
+        }
264
+    }
265 265
 
266
-	public function logData(string $message, array $data, array $context = []): void {
267
-		$this->logger->logData($message, $data, $context);
268
-	}
266
+    public function logData(string $message, array $data, array $context = []): void {
267
+        $this->logger->logData($message, $data, $context);
268
+    }
269 269
 }
Please login to merge, or discard this patch.