Parcourir la source

Se chequea que exista el servicio de monolog

Guillermo Espinoza il y a 8 ans
Parent
commit
c1b4a025c4
1 fichiers modifiés avec 7 ajouts et 4 suppressions
  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);