Prechádzať zdrojové kódy

Se chequea que exista el servicio de monolog

Guillermo Espinoza 7 rokov pred
rodič
commit
c1b4a025c4
1 zmenil súbory, kde vykonal 7 pridanie a 4 odobranie
  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);