Passed
Push — master ( 307b32...353946 )
by Ioannes
01:31
created
src/Monolog/ArrayFormatter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@
 block discarded – undo
14 14
 		$date = $record['datetime'];
15 15
 		$output = array(sprintf("%s %s", $record['level_name'], $date->format("d.m.Y H:i:s")));
16 16
         $output[] = $record['message'];
17
-		if(is_array($record['context'])) {
18
-		    if(count($record['context']) == 1) {
17
+		if (is_array($record['context'])) {
18
+		    if (count($record['context']) == 1) {
19 19
                 $output[] = current($record['context']);
20
-            } else if(count($record['context']) > 1) {
20
+            } else if (count($record['context']) > 1) {
21 21
                 $output[] = print_r($record['context'], true);
22 22
             }
23
-        } else if(!empty($record['context'])) {
23
+        } else if (!empty($record['context'])) {
24 24
             $output[] = $record['context'];
25 25
         }
26 26
 
Please login to merge, or discard this patch.
examples/log_test.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 define("NO_KEEP_STATISTIC", "Y");
3
-define("NO_AGENT_STATISTIC","Y");
4
-require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_before.php');
3
+define("NO_AGENT_STATISTIC", "Y");
4
+require_once($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php');
5 5
 
6 6
 $log = new \App\Log('test');
7 7
 
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 try {
15 15
     throw new Exception('test exception');
16
-} catch(Exception $e) {
16
+} catch (Exception $e) {
17 17
     $log->error($e);
18 18
 }
19 19
 throw new Exception('test exception');
Please login to merge, or discard this patch.
src/Monolog/ExceptionHandlerLog.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,15 +34,15 @@
 block discarded – undo
34 34
     {
35 35
         try {
36 36
             $log = new Log();
37
-            if(is_callable($this->context)) {
37
+            if (is_callable($this->context)) {
38 38
                 try {
39 39
                     $context = call_user_func($this->context, $exception);
40
-                } catch(\Exception $e) {
40
+                } catch (\Exception $e) {
41 41
                     Log::logInnerException(new \Exception('Can not call ' . $this->context));
42 42
                 }
43 43
             }
44 44
             $log->critical($exception, (array) $this->context);
45
-        } catch(\Exception $e) {
45
+        } catch (\Exception $e) {
46 46
             Log::logInnerException($e);
47 47
         }
48 48
     }
Please login to merge, or discard this patch.
src/Log.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     public function __construct($channel = false) {
21 21
 
22 22
         $this->minDebugLevel = ($_ENV['APP_DEBUG_LEVEL'] ?: 'DEBUG');
23
-        if($channel) {
23
+        if ($channel) {
24 24
             $this->channel = $channel;
25 25
             //TODO: get channel options
26 26
         } else {
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
      */
174 174
     private function formatMessage($message) {
175 175
 
176
-        if($message instanceof \Exception || $message instanceof Error) {
176
+        if ($message instanceof \Exception || $message instanceof Error) {
177 177
             $message = (string) $message;
178
-        } else if(is_array($message) || is_object($message)) {
178
+        } else if (is_array($message) || is_object($message)) {
179 179
             $message = json_encode((array) $message, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
180 180
             $message = str_replace('\\u0000', '', $message);
181 181
         }
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
      */
188 188
     public function getLogger() {
189 189
 
190
-        if(Registry::hasLogger($this->channel)) {
190
+        if (Registry::hasLogger($this->channel)) {
191 191
             return Registry::getInstance($this->channel);
192 192
         }
193 193
         $logPath = $_SERVER['DOCUMENT_ROOT'] . ($_ENV['APP_LOG_FOLDER'] ?: '/log/');
194 194
         $logPath .= $this->channel . '/' . date('Y-m-d') . '.log';
195 195
         $logDir = pathinfo($logPath, PATHINFO_DIRNAME);
196
-        if(!file_exists($logDir)) {
196
+        if (!file_exists($logDir)) {
197 197
             $mode = 0775;
198
-            if(defined('BX_DIR_PERMISSIONS') && BX_DIR_PERMISSIONS) {
198
+            if (defined('BX_DIR_PERMISSIONS') && BX_DIR_PERMISSIONS) {
199 199
                 $mode = BX_DIR_PERMISSIONS;
200 200
             }
201 201
             mkdir($logDir, $mode, true);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 
219 219
         $levels = Logger::getLevels();
220 220
 
221
-        if($this->minDebugLevel && isset($levels[$this->minDebugLevel])) {
221
+        if ($this->minDebugLevel && isset($levels[$this->minDebugLevel])) {
222 222
             return $levels[$this->minDebugLevel];
223 223
         } else {
224 224
             return Logger::DEBUG;
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
             return true;
236 236
         }
237 237
         $min_level = $this->getMinErrorLevel();
238
-        if($level >= $min_level) {
238
+        if ($level >= $min_level) {
239 239
             return true;
240 240
         }
241 241
         return false;
Please login to merge, or discard this patch.