@@ -28,7 +28,7 @@ |
||
| 28 | 28 | // specified class name |
| 29 | 29 | 'packer' => null, |
| 30 | 30 | |
| 31 | - // optionally override FluentHandler-class to customize behaviour |
|
| 31 | + // optionally override FluentHandler-class to customize behaviour |
|
| 32 | 32 | 'handler' => null, |
| 33 | 33 | |
| 34 | 34 | 'tagFormat' => '{{channel}}.{{level_name}}', |
@@ -40,45 +40,45 @@ |
||
| 40 | 40 | * |
| 41 | 41 | * @return LoggerInterface |
| 42 | 42 | */ |
| 43 | - protected function createFluentDriver(array $config): LoggerInterface |
|
| 44 | - { |
|
| 45 | - return new Monolog($this->parseChannel($config), [ |
|
| 46 | - $this->prepareHandler( |
|
| 47 | - $this->createFluentHandler($config) |
|
| 48 | - ), |
|
| 49 | - ]); |
|
| 50 | - } |
|
| 43 | + protected function createFluentDriver(array $config): LoggerInterface |
|
| 44 | + { |
|
| 45 | + return new Monolog($this->parseChannel($config), [ |
|
| 46 | + $this->prepareHandler( |
|
| 47 | + $this->createFluentHandler($config) |
|
| 48 | + ), |
|
| 49 | + ]); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - private function createFluentHandler(array $config) : HandlerInterface |
|
| 53 | - { |
|
| 54 | - $configure = $this->app['config']['fluent']; |
|
| 52 | + private function createFluentHandler(array $config) : HandlerInterface |
|
| 53 | + { |
|
| 54 | + $configure = $this->app['config']['fluent']; |
|
| 55 | 55 | |
| 56 | - $packer = null; |
|
| 57 | - if (!is_null($configure['packer'])) { |
|
| 58 | - if (class_exists($configure['packer'])) { |
|
| 59 | - $packer = $this->app->make($configure['packer']); |
|
| 60 | - } |
|
| 61 | - } |
|
| 56 | + $packer = null; |
|
| 57 | + if (!is_null($configure['packer'])) { |
|
| 58 | + if (class_exists($configure['packer'])) { |
|
| 59 | + $packer = $this->app->make($configure['packer']); |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - $fluentHandler = FluentHandler::class; |
|
| 64 | - if (!is_null($configure['handler'])) { |
|
| 65 | - if (class_exists($configure['handler'])) { |
|
| 66 | - $fluentHandler = $configure['handler']; |
|
| 67 | - } |
|
| 68 | - } |
|
| 63 | + $fluentHandler = FluentHandler::class; |
|
| 64 | + if (!is_null($configure['handler'])) { |
|
| 65 | + if (class_exists($configure['handler'])) { |
|
| 66 | + $fluentHandler = $configure['handler']; |
|
| 67 | + } |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | - return new $fluentHandler( |
|
| 72 | - new FluentLogger( |
|
| 73 | - $configure['host'] ?? FluentLogger::DEFAULT_ADDRESS, |
|
| 74 | - (int)$configure['port'] ?? FluentLogger::DEFAULT_LISTEN_PORT, |
|
| 75 | - $configure['options'] ?? [], |
|
| 76 | - $packer |
|
| 77 | - ), |
|
| 78 | - $configure['tagFormat'] ?? null, |
|
| 79 | - $this->level($config) |
|
| 80 | - ); |
|
| 81 | - } |
|
| 71 | + return new $fluentHandler( |
|
| 72 | + new FluentLogger( |
|
| 73 | + $configure['host'] ?? FluentLogger::DEFAULT_ADDRESS, |
|
| 74 | + (int)$configure['port'] ?? FluentLogger::DEFAULT_LISTEN_PORT, |
|
| 75 | + $configure['options'] ?? [], |
|
| 76 | + $packer |
|
| 77 | + ), |
|
| 78 | + $configure['tagFormat'] ?? null, |
|
| 79 | + $this->level($config) |
|
| 80 | + ); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | 83 | /** |
| 84 | 84 | * @param array $config |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | return new $fluentHandler( |
| 72 | 72 | new FluentLogger( |
| 73 | 73 | $configure['host'] ?? FluentLogger::DEFAULT_ADDRESS, |
| 74 | - (int)$configure['port'] ?? FluentLogger::DEFAULT_LISTEN_PORT, |
|
| 74 | + (int) $configure['port'] ?? FluentLogger::DEFAULT_LISTEN_PORT, |
|
| 75 | 75 | $configure['options'] ?? [], |
| 76 | 76 | $packer |
| 77 | 77 | ), |
@@ -26,9 +26,9 @@ |
||
| 26 | 26 | { |
| 27 | 27 | protected function resolveLogManager(): void |
| 28 | 28 | { |
| 29 | - $configPath = __DIR__ . '/config/fluent.php'; |
|
| 29 | + $configPath = __DIR__.'/config/fluent.php'; |
|
| 30 | 30 | $this->mergeConfigFrom($configPath, 'fluent'); |
| 31 | - $this->app->singleton(FluentLogManager::class, function ($app) { |
|
| 31 | + $this->app->singleton(FluentLogManager::class, function($app) { |
|
| 32 | 32 | $app->configure('fluent'); |
| 33 | 33 | |
| 34 | 34 | return new FluentLogManager($app); |
@@ -26,10 +26,10 @@ |
||
| 26 | 26 | { |
| 27 | 27 | protected function resolveLogManager(): void |
| 28 | 28 | { |
| 29 | - $configPath = __DIR__ . '/config/fluent.php'; |
|
| 29 | + $configPath = __DIR__.'/config/fluent.php'; |
|
| 30 | 30 | $this->mergeConfigFrom($configPath, 'fluent'); |
| 31 | 31 | $this->publishes([$configPath => config_path('fluent.php')], 'log'); |
| 32 | - $this->app->singleton(FluentLogManager::class, function ($app) { |
|
| 32 | + $this->app->singleton(FluentLogManager::class, function($app) { |
|
| 33 | 33 | |
| 34 | 34 | return new FluentLogManager($app); |
| 35 | 35 | }); |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | $this->resolveLogManager(); |
| 37 | 37 | /** @var LogManager $log */ |
| 38 | 38 | $log = $this->app[LoggerInterface::class]; |
| 39 | - $log->extend('fluent', function ($app, array $config) { |
|
| 39 | + $log->extend('fluent', function($app, array $config) { |
|
| 40 | 40 | $manager = $app->make(FluentLogManager::class); |
| 41 | 41 | |
| 42 | 42 | return $manager($config); |