public static function createLogger(ContainerInterface $container) : MonologWriter
 {
     $logger = new MonologWriter(new Logger(self::getConfig($container, 'env', 'production')));
     if ($container->has(DispatcherContract::class)) {
         $logger->setEventsDispatcher($container->get(DispatcherContract::class));
     }
     return $logger;
 }
Beispiel #2
0
 public function testMessageInput()
 {
     $monolog = $this->mock(Logger::class);
     $monolog->shouldReceive('pushProcessor')->once();
     $monolog->shouldReceive('info')->once();
     $monolog->shouldReceive('warning')->once()->with('{"message": true}', []);
     $monolog->shouldReceive('debug')->once()->with(var_export((new ArrayableClass())->toArray(), true), []);
     $writer = new Writer($monolog);
     $writer->log('info', ['message' => true]);
     $writer->log('debug', new ArrayableClass());
     $writer->log('warning', new JsonableClass());
 }