everon/logger-redis

Logger plugin with Redis handler for EveronLogger

3.0.0 2023-08-04 13:39 UTC

This package is auto-updated.

Last update: 2024-12-04 16:55:16 UTC


README

Build and run tests

A plugin with Redis handler for EveronLogger.

Configuration

  • Configurator

    Everon\Shared\LoggerRedis\Configurator\Plugin\RedisLoggerPluginConfigurator

  • Redis Connection Configurator

    Everon\Shared\LoggerRedis\Configurator\Plugin\RedisConnectionConfigurator

  • Default Options

    'pluginClass' => \Everon\LoggerRedis\Plugin\Redis\RedisLoggerPlugin::class,
    'pluginFactoryClass' => null,
    'logLevel' => \Monolog\Level::Debug,
    'shouldBubble' => true,
    'key' => null,
    'capSize' => 0,
    'redisConnection' => \Everon\Shared\LoggerRedis\Configurator\Plugin\RedisConnectionConfigurator,
  • Default Options for RedisConnectionConfigurator

    'host' => null,
    'port' => 6379,
    'timeout' => 0.0,
    'password' => null,
    'persistentId' => null,
    'retryInterval' => 0,
    'readTimeout' => 0.0,
  • Plugin

    Everon\LoggerRedis\Plugin\Redis\RedisLoggerPlugin

  • Usage

    use Everon\Shared\Logger\Configurator\Plugin\LoggerConfigurator;
    use Everon\Shared\LoggerRedis\Configurator\Plugin\RedisLoggerPluginConfigurator;
    use Everon\Logger\EveronLoggerFacade;
    
    $redisPluginConfigurator = (new RedisLoggerPluginConfigurator())
      ->setLogLevel(\Monolog\Level::Info)
      ->setKey('foo-bar-queue');
    
    $redisPluginConfigurator->requireRedisConnection()
      ->setPersistentId('persistent-connection')
      ->setHost('redis.host')
      ->setReadTimeout(0.5)
      ->setRetryInterval(3)
      ->setTimeout(10);
    
    $configurator = (new LoggerConfigurator)
      ->setName('everon-logger-example')
      ->add($redisPluginConfigurator);
    
    $logger = (new EveronLoggerFacade)->buildLogger($configurator);
    
    $logger->info('lorem ipsum');

Requirements

  • PHP v8.1.x
  • Monolog v3.x

Installation

composer require everon/logger-redis