PHPackages                             opxcore/log-manager - 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. opxcore/log-manager

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

opxcore/log-manager
===================

The OpxCore log manager.

1.3.1(5y ago)113MITPHPPHP ^7.4

Since Jan 29Pushed 5y agoCompare

[ Source](https://github.com/opxcore/log-manager)[ Packagist](https://packagist.org/packages/opxcore/log-manager)[ RSS](/packages/opxcore-log-manager/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (8)Dependencies (4)Versions (14)Used By (0)

Log manager
===========

[](#log-manager)

[![Build Status](https://camo.githubusercontent.com/b1153ac7b568dca8c1620ab9e1a2bec3396a5cc3788ac52bbf0677d2226737b8/68747470733a2f2f7472617669732d63692e636f6d2f6f7078636f72652f6c6f672d6d616e616765722e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/opxcore/log-manager)[![Coverage Status](https://camo.githubusercontent.com/855b932943e61bda60b26e4faf4b5f3c38d4ae15ed9d99dcac80e00254eaec4b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6f7078636f72652f6c6f672d6d616e616765722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/opxcore/log-manager?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/0c04f7cdefdbfa027cef6c48a176ff23b8f5493408e7148024900241c2f399ea/68747470733a2f2f706f7365722e707567782e6f72672f6f7078636f72652f6c6f672d6d616e616765722f762f737461626c65)](https://packagist.org/packages/opxcore/log-manager)[![Total Downloads](https://camo.githubusercontent.com/c9173c5d12c378e6c8054165e3d977be30ae630f85b706540843aa6f75ffbf93/68747470733a2f2f706f7365722e707567782e6f72672f6f7078636f72652f6c6f672d6d616e616765722f646f776e6c6f616473)](https://packagist.org/packages/opxcore/log-manager)[![License](https://camo.githubusercontent.com/6929e0370627f0b0cf4284137e68c29b78444f12fec15b10b734e8ad2cc99c65/68747470733a2f2f706f7365722e707567782e6f72672f6f7078636f72652f6c6f672d6d616e616765722f6c6963656e7365)](https://packagist.org/packages/opxcore/log-manager)

Log manager is package to handle multiple loggers. All write (send or something else) logic and message formatting must be implemented in these loggers. Log manager is only resolves which logger will be used and fires log action for corresponding logger.

Each logger must implement [Psr\\Log\\LoggerInterface](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md#3-psrlogloggerinterface).

Installing
----------

[](#installing)

```
composer require opxcore/log-manager

```

Basic creating:
---------------

[](#basic-creating)

```
use OpxCore\Log\LogManager;

$manager = new LogManager($default, $loggers, $groups);
```

Creating with [container](https://github.com/opxcore/container)
---------------------------------------------------------------

[](#creating-with-container)

```
use OpxCore\Interfaces\LoggerInterface;
use OpxCore\Log\LogManager;

$container->bind(
    LoggerInterface::class,
    LogManager::class,
    [
        'default' => $default,
        'loggers' => $loggers,
        'groups' => $groups,
    ]
);

$manager = $container->make(LoggerInterface::class);
```

or

```
$container->bind(LoggerInterface::class, LogManager::class);

$manager = $container->make(LoggerInterface::class, [
        'default' => $default,
        'loggers' => $loggers,
        'groups' => $groups,
    ]);
```

Configuring and using
---------------------

[](#configuring-and-using)

Configuration array consists of three keys. Value of `'default'` must contain a name (or array of names) of logger to be used as default logger. `'loggers'` is a set of loggers to be used keyed by name. A required parameter of each logger is a `'driver'` containing class name of logger to be used with corresponding name (see examples below). Third additional key `'groups'` contain array of logger groups keyed by name of group.

Log manager extends [container](https://github.com/opxcore/container), so loggers will be resolved by it with all dependency injections. All loggers will be resolved on demand and instanced for future use. All parameters except `'driver'` will be passed to logger constructor as parameters.

Additionally, you can bind custom created logger:

```
$manager->bind('custom_logger', function() {
    return new Logger(...);
});
```

To get a certain logger call method `$manager->logger($name)` where `$name` is name of logger to be returned. If `null`given the default logger (or several loggers) will be used.

To get multiple log loggers use same method with an array of names `$manager->logger([$name1, $name2])`

In both cases `LoggerProxy` class with chosen loggers bindings will be returned, so `$manager->logger([$name1, $name2])->log($message)` will call log action on each of logger.

To use group logging use `$manager->group($group)` or `$manager->group([$group1, $group2])`. Each group will be resolved to set of loggers and then merged together, removing duplicates.

PSR-3
-----

[](#psr-3)

Log manager implements PSR-3. So available methods are:

```
$manager->emergency($message, $context);
$manager->alert($message, $context);
$manager->critical($message, $context);
$manager->error($message, $context);
$manager->warning($message, $context);
$manager->notice($message, $context);
$manager->info($message, $context);
$manager->debug($message, $context);
$manager->log($level, $message, $context);
```

These methods will call corresponding method of default logger(s).

Examples
--------

[](#examples)

Log manager configuration:

```
    $default = 'file'; // Also you can use 'default' => ['file', 'null'],
    $loggers = [
        'file' => [
            'driver' => \OpxCore\Log\LogFile::class,
            'filename' => '/www/project/logs',
        ],
        'null' => [
            'driver' => \OpxCore\Log\LogNull::class,
        ]
    ];
    $groups = [
        'local' => ['file', 'null'],
        'network' => ['email'],
    ];
```

Logger class:

```
namespace \OpxCore\Log;

class LogFile implements \Psr\Log\LoggerInterface
{
    protected string $filename;

    public function __construct(string $filename)
    {
        $this->filename = $filename;
    }

    ...
}
```

Calling `$manager->logger('file')` at first time will create and return LogFile class instance (for this example is equal to `new \OpxCore\Log\LogFile('/www/project/logs')`) and store it's an instance for future use. So calling `$manager->logger('file')` for second time will return same instance of logger.

For this example using

```
$manager->logger('file')->debug('Some message');
```

is equal to (as `'file'` set as default logger)

```
$manager->logger()->debug('Some message');
```

and equal to

```
$manager->debug('Some message');
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 95.7% 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 ~63 days

Recently: every ~188 days

Total

13

Last Release

1906d ago

Major Versions

0.0.5 → 1.02019-01-31

PHP version history (2 changes)0.0.1PHP ^7.1.3

1.2.1PHP ^7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/46634185?v=4)[opxcore](/maintainers/opxcore)[@opxcore](https://github.com/opxcore)

---

Top Contributors

[![lozovoyv](https://avatars.githubusercontent.com/u/21274927?v=4)](https://github.com/lozovoyv "lozovoyv (44 commits)")[![opxcore](https://avatars.githubusercontent.com/u/46634185?v=4)](https://github.com/opxcore "opxcore (2 commits)")

---

Tags

logopxcore

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/opxcore-log-manager/health.svg)

```
[![Health](https://phpackages.com/badges/opxcore-log-manager/health.svg)](https://phpackages.com/packages/opxcore-log-manager)
```

###  Alternatives

[monolog/monolog

Sends your logs to files, sockets, inboxes, databases and various web services

21.4k964.9M7.0k](/packages/monolog-monolog)[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[symfony/monolog-bundle

Symfony MonologBundle

2.9k249.1M1.6k](/packages/symfony-monolog-bundle)[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k45.4M309](/packages/spatie-laravel-activitylog)[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k227.1M273](/packages/sentry-sentry)[sentry/sentry-laravel

Laravel SDK for Sentry (https://sentry.io)

1.3k114.3M154](/packages/sentry-sentry-laravel)

PHPackages © 2026

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