瀏覽代碼

Se chequea que exista el servicio de monolog

Guillermo Espinoza 7 年之前
父節點
當前提交
c1b4a025c4
共有 1 個文件被更改,包括 7 次插入4 次删除
  1. 7 4
      Services/TaskLoggerService.php

+ 7 - 4
Services/TaskLoggerService.php

@@ -46,10 +46,13 @@ class TaskLoggerService implements ConsumerInterface
             $filename = $this->createTaskLoggerCmdFile($taskloggerId, $content);
             $output = $this->runProcess($filename);
             
-            $this->serviceContainer->get('monolog.logger.devicelog')->info($output['output'], [
-                'deviceType' => $msgBody['entityClass'],
-                'deviceId' => $msgBody['entityId'],
-            ]);
+            $monologLoggerId = 'monolog.logger.devicelog';
+            if ($this->serviceContainer->has($monologLoggerId)) {
+                $this->serviceContainer->get($monologLoggerId)->info($output['output'], [
+                    'deviceType' => $msgBody['entityClass'],
+                    'deviceId' => $msgBody['entityId'],
+                ]);
+            }
             
             var_export($output);