Bläddra i källkod

Logueo de envíos de mensajes a rabbit, acciones y eventos de workflow.

Maximiliano Schvindt 8 år sedan
förälder
incheckning
7e4ede885c
2 ändrade filer med 16 tillägg och 11 borttagningar
  1. 7 11
      Event/EventSubscriber.php
  2. 9 0
      Services/ProducerService.php

+ 7 - 11
Event/EventSubscriber.php

@@ -76,12 +76,8 @@ class EventSubscriber implements EventSubscriberInterface
             foreach($actions as $k => $action) {
                 $params = array('entity'=>$event->getSubject());
                 $this->completeAction($action, $params);
-
             }
-            
         }
-
-        
     }
     
     public function guard(GuardEvent $event)
@@ -103,7 +99,7 @@ class EventSubscriber implements EventSubscriberInterface
         $filter['workflowName'] = $object->getWorkflow();
         $filter['eventReference'] = $eventReference;
 
-        $logger->info("WORKFLOW-ACTION {$object->getWorkflowType()}.{$object->getWorkflow()} => EVENT {$eventType}:{$eventReference} => CLASS {$class}_id_{$object->getId()}");
+        $logger->info("EVENT {$eventType}:{$eventReference} => {$class}_id_{$object->getId()}");
 
         $actions = $em->getRepository("WorkflowBundle:Action")->findBy($filter);
 
@@ -125,15 +121,15 @@ class EventSubscriber implements EventSubscriberInterface
 
         $class = get_class($object);
         
-        $logger->info("WORKFLOW-ACTION {$class}_id_{$object->getId()} | action_id_{$action->getId()} => Render: {$rendered}");
+        $logger->info("ACTION (action_id_{$action->getId()}) {$action->getName()} | Task: '{$rendered}' => {$class}_id_{$object->getId()}");
         
-        $string = file_get_contents("/var/flowdat/ftth/out.log");
+        // $string = file_get_contents("/var/flowdat/ftth/out.log");
             
-        $string .= "### Action id :".$action->getId().PHP_EOL;
-        $string .= "----------------------".PHP_EOL.$template.PHP_EOL;
-        $string .= "----------------------".PHP_EOL.$rendered.PHP_EOL.PHP_EOL;
+        // $string .= "### Action id :".$action->getId().PHP_EOL;
+        // $string .= "----------------------".PHP_EOL.$template.PHP_EOL;
+        // $string .= "----------------------".PHP_EOL.$rendered.PHP_EOL.PHP_EOL;
         
-        file_put_contents("/var/flowdat/ftth/out.log", $string);
+        // file_put_contents("/var/flowdat/ftth/out.log", $string);
 
     }
     

+ 9 - 0
Services/ProducerService.php

@@ -92,6 +92,15 @@ class ProducerService
             'content' => $action->render($entity),
         );
         $this->producer->publish(serialize($msg));
+        
+        $entityClass = get_class($entity);
+        $actionName = $action->getName();
+        $entityId = $entity->getId();
+        
+        $msg = serialize($msg);
+
+        $logger = $this->serviceContainer->get('logger');
+        $logger->info("PUBLISH-RABBIT {$actionName} | {$entityClass}_id_{$entityId} | msg: {$msg}");
     }
 
 }