PHPackages                             eonx-com/easy-logging - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. eonx-com/easy-logging

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

eonx-com/easy-logging
=====================

Create and configure Monolog Loggers easily

6.20.0(2mo ago)11.1M↓24.2%4MITPHPPHP ^8.2

Since Nov 26Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/eonx-com/easy-logging)[ Packagist](https://packagist.org/packages/eonx-com/easy-logging)[ RSS](/packages/eonx-com-easy-logging/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (20)Versions (561)Used By (4)

\---eonx\_docs--- title: Introduction weight: 0 ---eonx\_docs---

This package allows you to create and configure [Monolog Loggers](https://github.com/Seldaek/monolog) in centralised and reusable way:

- Configure channels using PHP
- Control Handlers and Processors order
- Integration with popular frameworks (e.g. Laravel, Symfony)
- Discover Handlers and Processors automatically in your application

### Require package (Composer)

[](#require-package-composer)

The recommended way to install this package is to use [Composer](https://getcomposer.org/):

```
$ composer require eonx-com/easy-logging
```

### Usage

[](#usage)

Here is a simple example on how to use the `LoggerFactoryInterface` to create loggers:

```
// Instantiate the logger factory manually or use DI ...

$default = $loggerFactory->create(); // Calling create without arguments will create logger for default channel

$console = $loggerFactory->create('console'); // Create logger for console channel specifically
```

### Usage in Framework

[](#usage-in-framework)

The different integrations provided by this package will by default register the logger for your default channel in the service container under the following service ids:

- `Psr\Log\LoggerInterface`
- `logger`

You can then use dependency injection anywhere you like!

Thanks to [Autowiring via setters](https://symfony.com/doc/current/service_container/autowiring.html#autowiring-calls) in Symfony, you can use `\EonX\EasyLogging\Logger\LoggerAwareTrait`to simplify the injection of `Psr\Log\LoggerInterface`.

### Logger Configuration

[](#logger-configuration)

The `LoggerFactoryInterface` allows you to set different collections of "config providers", each config can define:

- **channels:** if defined the config will be applied only to given channels, if `null` the config will be applied to all channels
- **priority:** define the order each config must be set on the logger instance, higher the priority later the config will be added to the logger instance

###### HandlerConfig

[](#handlerconfig)

The `HandlerConfigInterface` allows you to configure `\Monolog\Handler\HandlerInterface` to be set loggers created by the factory. Like other configs, it allows you to specify a list of channels this handler is for and, also a priority to control when the handler must be executed.

To tell the logger factory about your `HandlerConfigInterface`, you must use a `HandlerConfigProviderInterface`. The logger factory accepts a collection of providers via the `setHandlerConfigProviders()` method:

```
use EonX\EasyLogging\Factory\LoggerFactory;

$handlerConfigProviders = [];

// Add your own handler config providers to $handlerConfigProviders ...

$loggerFactory = new LoggerFactory();

// Set your handler config providers on the logger factory
$loggerFactory->setHandlerConfigProviders($handlerConfigProviders);
```

Here is a simple example of a `HandlerConfigProviderInterface` to register a `StreamHandler`:

```
namespace App\Logger;

use EonX\EasyLogging\Config\HandlerConfig;
use EonX\EasyLogging\Provider\HandlerConfigProviderInterface;
use Monolog\Handler\StreamHandler;

final class StreamHandlerConfigProvider implements HandlerConfigProviderInterface
{
    /**
     * @return iterable
     */
    public function handlers(): iterable
    {
        /**
         * This method returns an iterable to make it easier to handle complex handler configs definition
         * But you can simply return an array if you want.
         */

        yield new HandlerConfig(new StreamHandler('php://stdout'));
    }
}
```

###### ProcessorConfig

[](#processorconfig)

The `ProcessorConfigInterface` allows you to configure `\Monolog\Processor\ProcessorInterface` to be set loggers created by the factory. Like other configs, it allows you to specify a list of channels this handler is for and, also a priority to control when the handler must be executed.

To tell the logger factory about your `ProcessorConfigInterface`, you must use a `ProcessorConfigProviderInterface`. The logger factory accepts a collection of providers via the `setProcessorConfigProviders()` method:

```
use EonX\EasyLogging\Factory\LoggerFactory;

$processorConfigProviders = [];

// Add your own processor config providers to $handlerConfigProviders ...

$loggerFactory = new LoggerFactory();

// Set your processor config providers on the logger factory
$loggerFactory->setProcessorConfigProviders($processorConfigProviders);
```

Here is a simple example of a `ProcessorConfigProviderInterface` to register a `TagProcessor`:

```
namespace App\Logger;

use EonX\EasyLogging\Config\ProcessorConfig;
use EonX\EasyLogging\Provider\ProcessorConfigProviderInterface;
use Monolog\Processor\TagProcessor;

final class TagProcessorConfigProvider implements ProcessorConfigProviderInterface
{
    /**
     * @return iterable
     */
    public function processors(): iterable
    {
        /**
         * This method returns an iterable to make it easier to handle complex processor configs definition
         * But you can simply return an array if you want.
         */

        yield new ProcessorConfig(new TagProcessor(['tag-1', 'tag-2']));
    }
}
```

###### LoggerConfigurator

[](#loggerconfigurator)

The `\Monolog\Logger` class has methods allowing you to configure it even more (e.g. using microseconds). To deal with that, the logger factory accepts a collection of `LoggerConfiguratorInterface`.

To tell the logger factory about your `LoggerConfiguratorInterface`, you must call the `setLoggerConfigurators()` method:

```
use EonX\EasyLogging\Factory\LoggerFactory;

$loggerConfigurators = [];

// Add your own logger configurators to $loggerConfigurators ...

$loggerFactory = new LoggerFactory();

// Set your logger configurators on the logger factory
$loggerFactory->setLoggerConfigurators($loggerConfigurators);
```

Here is a simple example of a `LoggerConfiguratorInterface` to use microseconds:

```
namespace App\Logger;

use EonX\EasyLogging\Config\AbstractLoggingConfig;
use EonX\EasyLogging\Configurator\LoggerConfiguratorInterface;
use Monolog\Logger;

final class UseMicrosecondsLoggerConfigurator extends AbstractLoggingConfig implements LoggerConfiguratorInterface
{
    public function configure(Logger $logger) : void
    {
        $logger->useMicrosecondTimestamps(true);
    }
}
```

###  Health Score

64

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity39

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity89

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 70.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Total

526

Last Release

66d ago

Major Versions

4.5.5 → 5.6.112023-11-26

5.13.1 → 6.0.0-alpha2024-08-15

5.13.2 → 6.x-dev2024-08-27

4.5.6 → 6.0.12024-09-24

4.5.8 → 6.8.02025-02-20

PHP version history (5 changes)v0.10.8PHP ^7.1

v2.5.0PHP ^7.2

3.4.0PHP ^7.2 || ^8.0

4.0.1PHP ^8.1

6.0.0-alphaPHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/c6a35b20deec24986ee5baf0b9597829cb7fddc6f27188fd41fef91864877022?d=identicon)[eonx](/maintainers/eonx)

---

Top Contributors

[![natepage](https://avatars.githubusercontent.com/u/11576446?v=4)](https://github.com/natepage "natepage (586 commits)")[![roman-eonx](https://avatars.githubusercontent.com/u/48544017?v=4)](https://github.com/roman-eonx "roman-eonx (159 commits)")[![alexndlm](https://avatars.githubusercontent.com/u/6824784?v=4)](https://github.com/alexndlm "alexndlm (42 commits)")[![itorgov](https://avatars.githubusercontent.com/u/1703419?v=4)](https://github.com/itorgov "itorgov (27 commits)")[![TomasVotruba](https://avatars.githubusercontent.com/u/924196?v=4)](https://github.com/TomasVotruba "TomasVotruba (5 commits)")[![ERuban](https://avatars.githubusercontent.com/u/13186130?v=4)](https://github.com/ERuban "ERuban (4 commits)")[![voodooism](https://avatars.githubusercontent.com/u/31572316?v=4)](https://github.com/voodooism "voodooism (2 commits)")[![BOB41K1987](https://avatars.githubusercontent.com/u/20467102?v=4)](https://github.com/BOB41K1987 "BOB41K1987 (2 commits)")[![DKeeper](https://avatars.githubusercontent.com/u/1589751?v=4)](https://github.com/DKeeper "DKeeper (2 commits)")[![merk](https://avatars.githubusercontent.com/u/278097?v=4)](https://github.com/merk "merk (1 commits)")[![egor-dev](https://avatars.githubusercontent.com/u/13471770?v=4)](https://github.com/egor-dev "egor-dev (1 commits)")[![alexandrtspl](https://avatars.githubusercontent.com/u/90907144?v=4)](https://github.com/alexandrtspl "alexandrtspl (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/eonx-com-easy-logging/health.svg)

```
[![Health](https://phpackages.com/badges/eonx-com-easy-logging/health.svg)](https://phpackages.com/packages/eonx-com-easy-logging)
```

###  Alternatives

[symfony/monolog-bridge

Provides integration for Monolog with various Symfony components

2.6k189.7M258](/packages/symfony-monolog-bridge)[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k172.9M1.8k](/packages/symfony-security-bundle)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[scheb/2fa

Two-factor authentication for Symfony applications (please use scheb/2fa-bundle to install)

578630.7k1](/packages/scheb-2fa)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
