Completed
Pull Request — master (#7826)
by Morris
228:48 queued 211:05
created
lib/private/Log.php 2 patches
Indentation   +328 added lines, -328 removed lines patch added patch discarded remove patch
@@ -52,332 +52,332 @@
 block discarded – undo
52 52
 
53 53
 class Log implements ILogger {
54 54
 
55
-	/** @var string */
56
-	private $logger;
57
-
58
-	/** @var SystemConfig */
59
-	private $config;
60
-
61
-	/** @var boolean|null cache the result of the log condition check for the request */
62
-	private $logConditionSatisfied = null;
63
-
64
-	/** @var Normalizer */
65
-	private $normalizer;
66
-
67
-	/** @var IRegistry */
68
-	private $crashReporters;
69
-
70
-	protected $methodsWithSensitiveParameters = [
71
-		// Session/User
72
-		'completeLogin',
73
-		'login',
74
-		'checkPassword',
75
-		'checkPasswordNoLogging',
76
-		'loginWithPassword',
77
-		'updatePrivateKeyPassword',
78
-		'validateUserPass',
79
-		'loginWithToken',
80
-		'\{closure\}',
81
-
82
-		// TokenProvider
83
-		'getToken',
84
-		'isTokenPassword',
85
-		'getPassword',
86
-		'decryptPassword',
87
-		'logClientIn',
88
-		'generateToken',
89
-		'validateToken',
90
-
91
-		// TwoFactorAuth
92
-		'solveChallenge',
93
-		'verifyChallenge',
94
-
95
-		// ICrypto
96
-		'calculateHMAC',
97
-		'encrypt',
98
-		'decrypt',
99
-
100
-		// LoginController
101
-		'tryLogin',
102
-		'confirmPassword',
103
-
104
-		// LDAP
105
-		'bind',
106
-		'areCredentialsValid',
107
-		'invokeLDAPMethod',
108
-
109
-		// Encryption
110
-		'storeKeyPair',
111
-		'setupUser',
112
-	];
113
-
114
-	/**
115
-	 * @param string $logger The logger that should be used
116
-	 * @param SystemConfig $config the system config object
117
-	 * @param Normalizer|null $normalizer
118
-	 * @param IRegistry|null $registry
119
-	 */
120
-	public function __construct($logger = null, SystemConfig $config = null, $normalizer = null, IRegistry $registry = null) {
121
-		// FIXME: Add this for backwards compatibility, should be fixed at some point probably
122
-		if($config === null) {
123
-			$config = \OC::$server->getSystemConfig();
124
-		}
125
-
126
-		$this->config = $config;
127
-
128
-		// FIXME: Add this for backwards compatibility, should be fixed at some point probably
129
-		if($logger === null) {
130
-			$logType = $this->config->getValue('log_type', 'file');
131
-			$this->logger = static::getLogClass($logType);
132
-			call_user_func(array($this->logger, 'init'));
133
-		} else {
134
-			$this->logger = $logger;
135
-		}
136
-		if ($normalizer === null) {
137
-			$this->normalizer = new Normalizer();
138
-		} else {
139
-			$this->normalizer = $normalizer;
140
-		}
141
-		$this->crashReporters = $registry;
142
-	}
143
-
144
-	/**
145
-	 * System is unusable.
146
-	 *
147
-	 * @param string $message
148
-	 * @param array $context
149
-	 * @return void
150
-	 */
151
-	public function emergency($message, array $context = array()) {
152
-		$this->log(Util::FATAL, $message, $context);
153
-	}
154
-
155
-	/**
156
-	 * Action must be taken immediately.
157
-	 *
158
-	 * Example: Entire website down, database unavailable, etc. This should
159
-	 * trigger the SMS alerts and wake you up.
160
-	 *
161
-	 * @param string $message
162
-	 * @param array $context
163
-	 * @return void
164
-	 */
165
-	public function alert($message, array $context = array()) {
166
-		$this->log(Util::ERROR, $message, $context);
167
-	}
168
-
169
-	/**
170
-	 * Critical conditions.
171
-	 *
172
-	 * Example: Application component unavailable, unexpected exception.
173
-	 *
174
-	 * @param string $message
175
-	 * @param array $context
176
-	 * @return void
177
-	 */
178
-	public function critical($message, array $context = array()) {
179
-		$this->log(Util::ERROR, $message, $context);
180
-	}
181
-
182
-	/**
183
-	 * Runtime errors that do not require immediate action but should typically
184
-	 * be logged and monitored.
185
-	 *
186
-	 * @param string $message
187
-	 * @param array $context
188
-	 * @return void
189
-	 */
190
-	public function error($message, array $context = array()) {
191
-		$this->log(Util::ERROR, $message, $context);
192
-	}
193
-
194
-	/**
195
-	 * Exceptional occurrences that are not errors.
196
-	 *
197
-	 * Example: Use of deprecated APIs, poor use of an API, undesirable things
198
-	 * that are not necessarily wrong.
199
-	 *
200
-	 * @param string $message
201
-	 * @param array $context
202
-	 * @return void
203
-	 */
204
-	public function warning($message, array $context = array()) {
205
-		$this->log(Util::WARN, $message, $context);
206
-	}
207
-
208
-	/**
209
-	 * Normal but significant events.
210
-	 *
211
-	 * @param string $message
212
-	 * @param array $context
213
-	 * @return void
214
-	 */
215
-	public function notice($message, array $context = array()) {
216
-		$this->log(Util::INFO, $message, $context);
217
-	}
218
-
219
-	/**
220
-	 * Interesting events.
221
-	 *
222
-	 * Example: User logs in, SQL logs.
223
-	 *
224
-	 * @param string $message
225
-	 * @param array $context
226
-	 * @return void
227
-	 */
228
-	public function info($message, array $context = array()) {
229
-		$this->log(Util::INFO, $message, $context);
230
-	}
231
-
232
-	/**
233
-	 * Detailed debug information.
234
-	 *
235
-	 * @param string $message
236
-	 * @param array $context
237
-	 * @return void
238
-	 */
239
-	public function debug($message, array $context = array()) {
240
-		$this->log(Util::DEBUG, $message, $context);
241
-	}
242
-
243
-
244
-	/**
245
-	 * Logs with an arbitrary level.
246
-	 *
247
-	 * @param mixed $level
248
-	 * @param string|array $message
249
-	 * @param array $context
250
-	 * @return void
251
-	 */
252
-	public function log($level, $message, array $context = array()) {
253
-		$minLevel = min($this->config->getValue('loglevel', Util::WARN), Util::FATAL);
254
-		$logCondition = $this->config->getValue('log.condition', []);
255
-
256
-		array_walk($context, [$this->normalizer, 'format']);
257
-
258
-		if (isset($context['app'])) {
259
-			$app = $context['app'];
260
-
261
-			/**
262
-			 * check log condition based on the context of each log message
263
-			 * once this is met -> change the required log level to debug
264
-			 */
265
-			if(!empty($logCondition)
266
-				&& isset($logCondition['apps'])
267
-				&& in_array($app, $logCondition['apps'], true)) {
268
-				$minLevel = Util::DEBUG;
269
-			}
270
-
271
-		} else {
272
-			$app = 'no app in context';
273
-		}
274
-		if (is_string($message)) {
275
-			// interpolate $message as defined in PSR-3
276
-			$replace = array();
277
-			foreach ($context as $key => $val) {
278
-				$replace['{' . $key . '}'] = $val;
279
-			}
280
-
281
-			// interpolate replacement values into the message and return
282
-			$message = strtr($message, $replace);
283
-		}
284
-
285
-		/**
286
-		 * check for a special log condition - this enables an increased log on
287
-		 * a per request/user base
288
-		 */
289
-		if($this->logConditionSatisfied === null) {
290
-			// default to false to just process this once per request
291
-			$this->logConditionSatisfied = false;
292
-			if(!empty($logCondition)) {
293
-
294
-				// check for secret token in the request
295
-				if(isset($logCondition['shared_secret'])) {
296
-					$request = \OC::$server->getRequest();
297
-
298
-					// if token is found in the request change set the log condition to satisfied
299
-					if($request && hash_equals($logCondition['shared_secret'], $request->getParam('log_secret', ''))) {
300
-						$this->logConditionSatisfied = true;
301
-					}
302
-				}
303
-
304
-				// check for user
305
-				if(isset($logCondition['users'])) {
306
-					$user = \OC::$server->getUserSession()->getUser();
307
-
308
-					// if the user matches set the log condition to satisfied
309
-					if($user !== null && in_array($user->getUID(), $logCondition['users'], true)) {
310
-						$this->logConditionSatisfied = true;
311
-					}
312
-				}
313
-			}
314
-		}
315
-
316
-		// if log condition is satisfied change the required log level to DEBUG
317
-		if($this->logConditionSatisfied) {
318
-			$minLevel = Util::DEBUG;
319
-		}
320
-
321
-		if ($level >= $minLevel) {
322
-			$logger = $this->logger;
323
-			call_user_func(array($logger, 'write'), $app, $message, $level);
324
-		}
325
-	}
326
-
327
-	/**
328
-	 * Logs an exception very detailed
329
-	 *
330
-	 * @param \Exception|\Throwable $exception
331
-	 * @param array $context
332
-	 * @return void
333
-	 * @since 8.2.0
334
-	 */
335
-	public function logException($exception, array $context = array()) {
336
-		$level = Util::ERROR;
337
-		if (isset($context['level'])) {
338
-			$level = $context['level'];
339
-			unset($context['level']);
340
-		}
341
-		$data = array(
342
-			'CustomMessage' => isset($context['message']) ? $context['message'] : '--',
343
-			'Exception' => get_class($exception),
344
-			'Message' => $exception->getMessage(),
345
-			'Code' => $exception->getCode(),
346
-			'Trace' => $exception->getTraceAsString(),
347
-			'File' => $exception->getFile(),
348
-			'Line' => $exception->getLine(),
349
-		);
350
-		$data['Trace'] = preg_replace('!(' . implode('|', $this->methodsWithSensitiveParameters) . ')\(.*\)!', '$1(*** sensitive parameters replaced ***)', $data['Trace']);
351
-		$data['Trace'] = explode("\n", $data['Trace']);
352
-		if ($exception instanceof HintException) {
353
-			$data['Hint'] = $exception->getHint();
354
-		}
355
-		$this->log($level, $data, $context);
356
-		$context['level'] = $level;
357
-		if (!is_null($this->crashReporters)) {
358
-			$this->crashReporters->delegateReport($exception, $context);
359
-		}
360
-	}
361
-
362
-	/**
363
-	 * @param string $logType
364
-	 * @return string
365
-	 * @internal
366
-	 */
367
-	public static function getLogClass($logType) {
368
-		switch (strtolower($logType)) {
369
-			case 'errorlog':
370
-				return \OC\Log\Errorlog::class;
371
-			case 'syslog':
372
-				return \OC\Log\Syslog::class;
373
-			case 'file':
374
-				return \OC\Log\File::class;
375
-
376
-			// Backwards compatibility for old and fallback for unknown log types
377
-			case 'owncloud':
378
-			case 'nextcloud':
379
-			default:
380
-				return \OC\Log\File::class;
381
-		}
382
-	}
55
+    /** @var string */
56
+    private $logger;
57
+
58
+    /** @var SystemConfig */
59
+    private $config;
60
+
61
+    /** @var boolean|null cache the result of the log condition check for the request */
62
+    private $logConditionSatisfied = null;
63
+
64
+    /** @var Normalizer */
65
+    private $normalizer;
66
+
67
+    /** @var IRegistry */
68
+    private $crashReporters;
69
+
70
+    protected $methodsWithSensitiveParameters = [
71
+        // Session/User
72
+        'completeLogin',
73
+        'login',
74
+        'checkPassword',
75
+        'checkPasswordNoLogging',
76
+        'loginWithPassword',
77
+        'updatePrivateKeyPassword',
78
+        'validateUserPass',
79
+        'loginWithToken',
80
+        '\{closure\}',
81
+
82
+        // TokenProvider
83
+        'getToken',
84
+        'isTokenPassword',
85
+        'getPassword',
86
+        'decryptPassword',
87
+        'logClientIn',
88
+        'generateToken',
89
+        'validateToken',
90
+
91
+        // TwoFactorAuth
92
+        'solveChallenge',
93
+        'verifyChallenge',
94
+
95
+        // ICrypto
96
+        'calculateHMAC',
97
+        'encrypt',
98
+        'decrypt',
99
+
100
+        // LoginController
101
+        'tryLogin',
102
+        'confirmPassword',
103
+
104
+        // LDAP
105
+        'bind',
106
+        'areCredentialsValid',
107
+        'invokeLDAPMethod',
108
+
109
+        // Encryption
110
+        'storeKeyPair',
111
+        'setupUser',
112
+    ];
113
+
114
+    /**
115
+     * @param string $logger The logger that should be used
116
+     * @param SystemConfig $config the system config object
117
+     * @param Normalizer|null $normalizer
118
+     * @param IRegistry|null $registry
119
+     */
120
+    public function __construct($logger = null, SystemConfig $config = null, $normalizer = null, IRegistry $registry = null) {
121
+        // FIXME: Add this for backwards compatibility, should be fixed at some point probably
122
+        if($config === null) {
123
+            $config = \OC::$server->getSystemConfig();
124
+        }
125
+
126
+        $this->config = $config;
127
+
128
+        // FIXME: Add this for backwards compatibility, should be fixed at some point probably
129
+        if($logger === null) {
130
+            $logType = $this->config->getValue('log_type', 'file');
131
+            $this->logger = static::getLogClass($logType);
132
+            call_user_func(array($this->logger, 'init'));
133
+        } else {
134
+            $this->logger = $logger;
135
+        }
136
+        if ($normalizer === null) {
137
+            $this->normalizer = new Normalizer();
138
+        } else {
139
+            $this->normalizer = $normalizer;
140
+        }
141
+        $this->crashReporters = $registry;
142
+    }
143
+
144
+    /**
145
+     * System is unusable.
146
+     *
147
+     * @param string $message
148
+     * @param array $context
149
+     * @return void
150
+     */
151
+    public function emergency($message, array $context = array()) {
152
+        $this->log(Util::FATAL, $message, $context);
153
+    }
154
+
155
+    /**
156
+     * Action must be taken immediately.
157
+     *
158
+     * Example: Entire website down, database unavailable, etc. This should
159
+     * trigger the SMS alerts and wake you up.
160
+     *
161
+     * @param string $message
162
+     * @param array $context
163
+     * @return void
164
+     */
165
+    public function alert($message, array $context = array()) {
166
+        $this->log(Util::ERROR, $message, $context);
167
+    }
168
+
169
+    /**
170
+     * Critical conditions.
171
+     *
172
+     * Example: Application component unavailable, unexpected exception.
173
+     *
174
+     * @param string $message
175
+     * @param array $context
176
+     * @return void
177
+     */
178
+    public function critical($message, array $context = array()) {
179
+        $this->log(Util::ERROR, $message, $context);
180
+    }
181
+
182
+    /**
183
+     * Runtime errors that do not require immediate action but should typically
184
+     * be logged and monitored.
185
+     *
186
+     * @param string $message
187
+     * @param array $context
188
+     * @return void
189
+     */
190
+    public function error($message, array $context = array()) {
191
+        $this->log(Util::ERROR, $message, $context);
192
+    }
193
+
194
+    /**
195
+     * Exceptional occurrences that are not errors.
196
+     *
197
+     * Example: Use of deprecated APIs, poor use of an API, undesirable things
198
+     * that are not necessarily wrong.
199
+     *
200
+     * @param string $message
201
+     * @param array $context
202
+     * @return void
203
+     */
204
+    public function warning($message, array $context = array()) {
205
+        $this->log(Util::WARN, $message, $context);
206
+    }
207
+
208
+    /**
209
+     * Normal but significant events.
210
+     *
211
+     * @param string $message
212
+     * @param array $context
213
+     * @return void
214
+     */
215
+    public function notice($message, array $context = array()) {
216
+        $this->log(Util::INFO, $message, $context);
217
+    }
218
+
219
+    /**
220
+     * Interesting events.
221
+     *
222
+     * Example: User logs in, SQL logs.
223
+     *
224
+     * @param string $message
225
+     * @param array $context
226
+     * @return void
227
+     */
228
+    public function info($message, array $context = array()) {
229
+        $this->log(Util::INFO, $message, $context);
230
+    }
231
+
232
+    /**
233
+     * Detailed debug information.
234
+     *
235
+     * @param string $message
236
+     * @param array $context
237
+     * @return void
238
+     */
239
+    public function debug($message, array $context = array()) {
240
+        $this->log(Util::DEBUG, $message, $context);
241
+    }
242
+
243
+
244
+    /**
245
+     * Logs with an arbitrary level.
246
+     *
247
+     * @param mixed $level
248
+     * @param string|array $message
249
+     * @param array $context
250
+     * @return void
251
+     */
252
+    public function log($level, $message, array $context = array()) {
253
+        $minLevel = min($this->config->getValue('loglevel', Util::WARN), Util::FATAL);
254
+        $logCondition = $this->config->getValue('log.condition', []);
255
+
256
+        array_walk($context, [$this->normalizer, 'format']);
257
+
258
+        if (isset($context['app'])) {
259
+            $app = $context['app'];
260
+
261
+            /**
262
+             * check log condition based on the context of each log message
263
+             * once this is met -> change the required log level to debug
264
+             */
265
+            if(!empty($logCondition)
266
+                && isset($logCondition['apps'])
267
+                && in_array($app, $logCondition['apps'], true)) {
268
+                $minLevel = Util::DEBUG;
269
+            }
270
+
271
+        } else {
272
+            $app = 'no app in context';
273
+        }
274
+        if (is_string($message)) {
275
+            // interpolate $message as defined in PSR-3
276
+            $replace = array();
277
+            foreach ($context as $key => $val) {
278
+                $replace['{' . $key . '}'] = $val;
279
+            }
280
+
281
+            // interpolate replacement values into the message and return
282
+            $message = strtr($message, $replace);
283
+        }
284
+
285
+        /**
286
+         * check for a special log condition - this enables an increased log on
287
+         * a per request/user base
288
+         */
289
+        if($this->logConditionSatisfied === null) {
290
+            // default to false to just process this once per request
291
+            $this->logConditionSatisfied = false;
292
+            if(!empty($logCondition)) {
293
+
294
+                // check for secret token in the request
295
+                if(isset($logCondition['shared_secret'])) {
296
+                    $request = \OC::$server->getRequest();
297
+
298
+                    // if token is found in the request change set the log condition to satisfied
299
+                    if($request && hash_equals($logCondition['shared_secret'], $request->getParam('log_secret', ''))) {
300
+                        $this->logConditionSatisfied = true;
301
+                    }
302
+                }
303
+
304
+                // check for user
305
+                if(isset($logCondition['users'])) {
306
+                    $user = \OC::$server->getUserSession()->getUser();
307
+
308
+                    // if the user matches set the log condition to satisfied
309
+                    if($user !== null && in_array($user->getUID(), $logCondition['users'], true)) {
310
+                        $this->logConditionSatisfied = true;
311
+                    }
312
+                }
313
+            }
314
+        }
315
+
316
+        // if log condition is satisfied change the required log level to DEBUG
317
+        if($this->logConditionSatisfied) {
318
+            $minLevel = Util::DEBUG;
319
+        }
320
+
321
+        if ($level >= $minLevel) {
322
+            $logger = $this->logger;
323
+            call_user_func(array($logger, 'write'), $app, $message, $level);
324
+        }
325
+    }
326
+
327
+    /**
328
+     * Logs an exception very detailed
329
+     *
330
+     * @param \Exception|\Throwable $exception
331
+     * @param array $context
332
+     * @return void
333
+     * @since 8.2.0
334
+     */
335
+    public function logException($exception, array $context = array()) {
336
+        $level = Util::ERROR;
337
+        if (isset($context['level'])) {
338
+            $level = $context['level'];
339
+            unset($context['level']);
340
+        }
341
+        $data = array(
342
+            'CustomMessage' => isset($context['message']) ? $context['message'] : '--',
343
+            'Exception' => get_class($exception),
344
+            'Message' => $exception->getMessage(),
345
+            'Code' => $exception->getCode(),
346
+            'Trace' => $exception->getTraceAsString(),
347
+            'File' => $exception->getFile(),
348
+            'Line' => $exception->getLine(),
349
+        );
350
+        $data['Trace'] = preg_replace('!(' . implode('|', $this->methodsWithSensitiveParameters) . ')\(.*\)!', '$1(*** sensitive parameters replaced ***)', $data['Trace']);
351
+        $data['Trace'] = explode("\n", $data['Trace']);
352
+        if ($exception instanceof HintException) {
353
+            $data['Hint'] = $exception->getHint();
354
+        }
355
+        $this->log($level, $data, $context);
356
+        $context['level'] = $level;
357
+        if (!is_null($this->crashReporters)) {
358
+            $this->crashReporters->delegateReport($exception, $context);
359
+        }
360
+    }
361
+
362
+    /**
363
+     * @param string $logType
364
+     * @return string
365
+     * @internal
366
+     */
367
+    public static function getLogClass($logType) {
368
+        switch (strtolower($logType)) {
369
+            case 'errorlog':
370
+                return \OC\Log\Errorlog::class;
371
+            case 'syslog':
372
+                return \OC\Log\Syslog::class;
373
+            case 'file':
374
+                return \OC\Log\File::class;
375
+
376
+            // Backwards compatibility for old and fallback for unknown log types
377
+            case 'owncloud':
378
+            case 'nextcloud':
379
+            default:
380
+                return \OC\Log\File::class;
381
+        }
382
+    }
383 383
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function __construct($logger = null, SystemConfig $config = null, $normalizer = null, IRegistry $registry = null) {
121 121
 		// FIXME: Add this for backwards compatibility, should be fixed at some point probably
122
-		if($config === null) {
122
+		if ($config === null) {
123 123
 			$config = \OC::$server->getSystemConfig();
124 124
 		}
125 125
 
126 126
 		$this->config = $config;
127 127
 
128 128
 		// FIXME: Add this for backwards compatibility, should be fixed at some point probably
129
-		if($logger === null) {
129
+		if ($logger === null) {
130 130
 			$logType = $this->config->getValue('log_type', 'file');
131 131
 			$this->logger = static::getLogClass($logType);
132 132
 			call_user_func(array($this->logger, 'init'));
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 			 * check log condition based on the context of each log message
263 263
 			 * once this is met -> change the required log level to debug
264 264
 			 */
265
-			if(!empty($logCondition)
265
+			if (!empty($logCondition)
266 266
 				&& isset($logCondition['apps'])
267 267
 				&& in_array($app, $logCondition['apps'], true)) {
268 268
 				$minLevel = Util::DEBUG;
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 			// interpolate $message as defined in PSR-3
276 276
 			$replace = array();
277 277
 			foreach ($context as $key => $val) {
278
-				$replace['{' . $key . '}'] = $val;
278
+				$replace['{'.$key.'}'] = $val;
279 279
 			}
280 280
 
281 281
 			// interpolate replacement values into the message and return
@@ -286,27 +286,27 @@  discard block
 block discarded – undo
286 286
 		 * check for a special log condition - this enables an increased log on
287 287
 		 * a per request/user base
288 288
 		 */
289
-		if($this->logConditionSatisfied === null) {
289
+		if ($this->logConditionSatisfied === null) {
290 290
 			// default to false to just process this once per request
291 291
 			$this->logConditionSatisfied = false;
292
-			if(!empty($logCondition)) {
292
+			if (!empty($logCondition)) {
293 293
 
294 294
 				// check for secret token in the request
295
-				if(isset($logCondition['shared_secret'])) {
295
+				if (isset($logCondition['shared_secret'])) {
296 296
 					$request = \OC::$server->getRequest();
297 297
 
298 298
 					// if token is found in the request change set the log condition to satisfied
299
-					if($request && hash_equals($logCondition['shared_secret'], $request->getParam('log_secret', ''))) {
299
+					if ($request && hash_equals($logCondition['shared_secret'], $request->getParam('log_secret', ''))) {
300 300
 						$this->logConditionSatisfied = true;
301 301
 					}
302 302
 				}
303 303
 
304 304
 				// check for user
305
-				if(isset($logCondition['users'])) {
305
+				if (isset($logCondition['users'])) {
306 306
 					$user = \OC::$server->getUserSession()->getUser();
307 307
 
308 308
 					// if the user matches set the log condition to satisfied
309
-					if($user !== null && in_array($user->getUID(), $logCondition['users'], true)) {
309
+					if ($user !== null && in_array($user->getUID(), $logCondition['users'], true)) {
310 310
 						$this->logConditionSatisfied = true;
311 311
 					}
312 312
 				}
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		}
315 315
 
316 316
 		// if log condition is satisfied change the required log level to DEBUG
317
-		if($this->logConditionSatisfied) {
317
+		if ($this->logConditionSatisfied) {
318 318
 			$minLevel = Util::DEBUG;
319 319
 		}
320 320
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 			'File' => $exception->getFile(),
348 348
 			'Line' => $exception->getLine(),
349 349
 		);
350
-		$data['Trace'] = preg_replace('!(' . implode('|', $this->methodsWithSensitiveParameters) . ')\(.*\)!', '$1(*** sensitive parameters replaced ***)', $data['Trace']);
350
+		$data['Trace'] = preg_replace('!('.implode('|', $this->methodsWithSensitiveParameters).')\(.*\)!', '$1(*** sensitive parameters replaced ***)', $data['Trace']);
351 351
 		$data['Trace'] = explode("\n", $data['Trace']);
352 352
 		if ($exception instanceof HintException) {
353 353
 			$data['Hint'] = $exception->getHint();
Please login to merge, or discard this patch.