everon / logger-gelf
Logger plugin with Gelf/Graylog handler for EveronLogger
Requires
- php: ^8.1
- everon/logger: ^3
- graylog2/gelf-php: ^2
Requires (Dev)
- ext-json: *
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10
- popo/generator: ^6
- symfony/var-dumper: ^5|^6
This package is auto-updated.
Last update: 2024-12-04 22:47:15 UTC
README
A plugin with Graylog2 handler for EveronLogger.
- GelfHttp
- GelfTcp
- GelfUdp
Note: Gelf offers several transport protocols, and could be configured via related properties
of GelfLoggerPluginConfigurator
.
Plugins
GelfHttp
-
Configurator
Everon\Shared\LoggerGelf\Configurator\Plugin\GelfHttpLoggerPluginConfigurator
-
Default Options
'pluginClass' => \Everon\LoggerGelf\Plugin\GelfHttp\GelfHttpLoggerPlugin::class, 'pluginFactoryClass' => NULL, 'logLevel' => \Monolog\Level::Debug, 'shouldBubble' => true, 'ignoreTransportErrors' => true, 'host' => '127.0.0.1', 'port' => 12202, 'path' => '/gelf', 'sslOptions' => NULL,
-
Plugin
Everon\LoggerGelf\Plugin\GelfHttp\GelfHttpLoggerPlugin
GelfTcp
-
Configurator
Everon\Shared\LoggerGelf\Configurator\Plugin\GelfTcpLoggerPluginConfigurator
-
Default Options
'pluginClass' => \Everon\LoggerGelf\Plugin\GelfTcp\GelfTcpLoggerPlugin::class, 'pluginFactoryClass' => NULL, 'logLevel' => \Monolog\Level::Debug, 'shouldBubble' => true, 'ignoreTransportErrors' => true, 'host' => '127.0.0.1', 'port' => 12201, 'sslOptions' => NULL,
-
Plugin
Everon\LoggerGelf\Plugin\GelfTcp\GelfTcpLoggerPlugin
GelfUdp
-
Configurator
Everon\Shared\LoggerGelf\Configurator\Plugin\GelfUdpLoggerPluginConfigurator
-
Default Options for
GelfUdpLoggerPluginConfigurator
'pluginClass' => \Everon\LoggerGelf\Plugin\GelfUdp\GelfUdpLoggerPlugin::class, 'pluginFactoryClass' => NULL, 'logLevel' => \Monolog\Level::Debug, 'shouldBubble' => true, 'ignoreTransportErrors' => true, 'host' => '127.0.0.1', 'port' => 12201, 'chunkSize' => \Gelf\Transport\UdpTransport::CHUNK_SIZE_WAN,
-
Plugin
Everon\LoggerGelf\Plugin\GelfUdp\GelfUdpLoggerPlugin
Gelf SSL Options
-
Default Options for
GelfLoggerPluginSslOptions
'verifyPeer' => true, 'allowSelfSigned' => false, 'caFile' => NULL, 'ciphers' => NULL, 'useSsl' => false,
-
Usage
use Everon\Shared\Logger\Configurator\Plugin\LoggerConfigurator; use Everon\Logger\EveronLoggerFacade; use Everon\Shared\LoggerGelf\Configurator\Plugin\GelfHttpLoggerPluginConfigurator; use Everon\Shared\LoggerGelf\Configurator\Plugin\GelfTcpLoggerPluginConfigurator; use Everon\Shared\LoggerGelf\Configurator\Plugin\GelfUdpLoggerPluginConfigurator; use Monolog\Level; $gelfHttpPluginConfigurator = (new GelfHttpLoggerPluginConfigurator) ->setLogLevel(Level::Debug) ->setHost('graylog.host.http'); $gelfTcpPluginConfigurator = (new GelfTcpLoggerPluginConfigurator) ->setLogLevel(Level::Warning) ->setHost('graylog.host.tcp'); $gelfUdpPluginConfigurator = (new GelfUdpLoggerPluginConfigurator) ->setLogLevel(Level::Info) ->setHost('graylog.host.udp'); $configurator = (new LoggerConfigurator) ->addPluginConfigurator($gelfHttpPluginConfigurator) ->addPluginConfigurator($gelfTcpPluginConfigurator) ->addPluginConfigurator($gelfUdpPluginConfigurator); $logger = (new EveronLoggerFacade())->buildLogger($configurator); $logger->info('lorem ipsum');
Requirements
- PHP v8.1.x
- Monolog v3.x
Installation
composer require everon/logger-gelf