PHPackages                             bayfrontmedia/multi-logger - 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. bayfrontmedia/multi-logger

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

bayfrontmedia/multi-logger
==========================

An easy-to-use library used to manage multiple Monolog channels from a single class.

v1.2.0(1y ago)01271MITPHPPHP ^8.0

Since Aug 12Pushed 1y agoCompare

[ Source](https://github.com/bayfrontmedia/multi-logger)[ Packagist](https://packagist.org/packages/bayfrontmedia/multi-logger)[ Docs](https://github.com/bayfrontmedia/multi-logger)[ RSS](/packages/bayfrontmedia-multi-logger/feed)WikiDiscussions master Synced yesterday

READMEChangelog (4)Dependencies (1)Versions (5)Used By (1)

Multi-Logger
------------

[](#multi-logger)

An easy-to-use library used to manage multiple [Monolog](https://github.com/Seldaek/monolog) channels from a single class.

- [License](#license)
- [Author](#author)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)

License
-------

[](#license)

This project is open source and available under the [MIT License](LICENSE).

Author
------

[](#author)

[![Bayfront Media](https://camo.githubusercontent.com/0c0163913b2092e97dbf9684970adaf86f2f25871298d3d28b2dff4bf75b2915/68747470733a2f2f63646e312e6f6e62617966726f6e742e636f6d2f62666d2f6272616e642f62666d2d6c6f676f2e737667)](https://camo.githubusercontent.com/0c0163913b2092e97dbf9684970adaf86f2f25871298d3d28b2dff4bf75b2915/68747470733a2f2f63646e312e6f6e62617966726f6e742e636f6d2f62666d2f6272616e642f62666d2d6c6f676f2e737667)

- [Bayfront Media homepage](https://www.bayfrontmedia.com?utm_source=github&utm_medium=direct)
- [Bayfront Media GitHub](https://github.com/bayfrontmedia)

Requirements
------------

[](#requirements)

- PHP `^8.0` (Tested up to `8.4`)

Installation
------------

[](#installation)

```
composer require bayfrontmedia/multi-logger

```

Usage
-----

[](#usage)

**NOTE:** All exceptions thrown by Multi-Logger extend `Bayfront\MultiLogger\Exceptions\MultiLoggerException`, so you can choose to catch exceptions as narrowly or broadly as you like.

Multi-Logger exists in order manage multiple Monolog channels from a single class.

In some cases, you may still need to interact with the `Monolog\Logger` object directly, and Multi-Logger allows you to do that via the [getChannel](#getchannel) method.

A `Logger` instance must be passed to the constructor, and will automatically be set as the default and current channel.

To aid in consistency when referencing log channels, the `Bayfront\MultiLogger\ChannelName` class contains constants with suggested channel names, including:

- `APP`
- `AUDIT`
- `CLI`
- `DATABASE`
- `CONTROLLER`
- `DEV`
- `ERROR`
- `HEALTH`
- `HTTP`
- `JOB`
- `MODEL`
- `NOTIFICATION`
- `OPS`
- `PRIVILEGES`
- `PROD`
- `QA`
- `QUEUE`
- `REQUEST`
- `RESPONSE`
- `ROUTER`
- `SCHEDULE`
- `SECURITY`
- `STAGING`
- `STORAGE`

**Example:**

```
use Bayfront\MultiLogger\ChannelName;
use Bayfront\MultiLogger\Log;
use Monolog\Logger;
use Monolog\Handler\FirePHPHandler;

$app_channel = new Logger(ChannelName::APP);
$app_channel->pushHandler(new FirePHPHandler());

$log = new Log($app_channel);
```

### Public methods

[](#public-methods)

- [getChannels](#getchannels)
- [getDefaultChannel](#getdefaultchannel)
- [getCurrentChannel](#getcurrentchannel)
- [addChannel](#addchannel)
- [isChannel](#ischannel)
- [getChannel](#getchannel)
- [channel](#channel)

**Logging events**

- [emergency](#emergency)
- [alert](#alert)
- [critical](#critical)
- [error](#error)
- [warning](#warning)
- [notice](#notice)
- [info](#info)
- [debug](#debug)
- [log](#log)

---

### getChannels

[](#getchannels)

**Description:**

Return array of channel names.

**Parameters:**

- (None)

**Returns:**

- (array)

---

### getDefaultChannel

[](#getdefaultchannel)

**Description:**

Return name of default channel.

**Parameters:**

- (None)

**Returns:**

- (string)

---

### getCurrentChannel

[](#getcurrentchannel)

**Description:**

Return name of current channel.

**Parameters:**

- (None)

**Returns:**

- (string)

---

### addChannel

[](#addchannel)

**Description:**

Add a logger instance as a new channel with the same name.

If an existing instance exists with the same name, it will be overwritten.

**Parameters:**

- `$logger` (object): `Monolog\Logger` object

**Returns:**

- (self)

**Example:**

```
use Bayfront\MultiLogger\ChannelName;
use Monolog\Logger;
use Monolog\Handler\FirePHPHandler;

$audit_channel = new Logger(ChannelName::AUDIT);
$audit_channel->pushHandler(new FirePHPHandler());

$log->addChannel($audit_channel);
```

---

### isChannel

[](#ischannel)

**Description:**

Does channel name exist?

**Parameters:**

- `$channel` (string)

**Returns:**

- (bool)

**Example:**

```
if ($log->isChannel(ChannelName::APP)) {
    // Do something
}

```

---

### getChannel

[](#getchannel)

**Description:**

Returns `Logger` instance for a given channel.

**Parameters:**

- `$channel = ''` (string): Name of channel to return. If empty string, the current channel will be returned.

**Returns:**

- (object): `Monolog\Logger` object

**Throws:**

- `Bayfront\MultiLogger\Exceptions\ChannelNotFoundException`

**Example:**

```
try {

    $app_channel = $log->getChannel(ChannelName::APP);

} catch (ChannelNotFoundException $e) {
    die($e->getMessage());
}

```

---

### channel

[](#channel)

**Description:**

Set the channel name to be used for the next logged event.

By default, all logged events will be logged to the default channel used in the constructor.

**Parameters:**

- `$channel` (string)

**Returns:**

- (self)

**Throws:**

- `Bayfront\MultiLogger\Exceptions\ChannelNotFoundException`

**Example:**

```
try {

    $log->channel(ChannelName::AUDIT)->info('This is an informational log message.');

} catch (ChannelNotFoundException $e) {
    die($e->getMessage());
}

```

---

### emergency

[](#emergency)

**Description:**

System is unusable.

**Parameters:**

- `$message` (string)
- `$context` (array)

**Returns:**

- (void)

---

### alert

[](#alert)

**Description:**

Action must be taken immediately.

Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.

**Parameters:**

- `$message` (string)
- `$context` (array)

**Returns:**

- (void)

---

### critical

[](#critical)

**Description:**

Critical conditions.

Example: Application component unavailable, unexpected exception.

**Parameters:**

- `$message` (string)
- `$context` (array)

**Returns:**

- (void)

---

### error

[](#error)

**Description:**

Runtime errors that do not require immediate action but should typically be logged and monitored.

**Parameters:**

- `$message` (string)
- `$context` (array)

**Returns:**

- (void)

---

### warning

[](#warning)

**Description:**

Exceptional occurrences that are not errors.

Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.

**Parameters:**

- `$message` (string)
- `$context` (array)

**Returns:**

- (void)

---

### notice

[](#notice)

**Description:**

Normal but significant events.

**Parameters:**

- `$message` (string)
- `$context` (array)

**Returns:**

- (void)

---

### info

[](#info)

**Description:**

Interesting events.

Example: User logs in, SQL logs.

**Parameters:**

- `$message` (string)
- `$context` (array)

**Returns:**

- (void)

---

### debug

[](#debug)

**Description:**

Detailed debug information.

**Parameters:**

- `$message` (string)
- `$context` (array)

**Returns:**

- (void)

---

### log

[](#log)

**Description:**

Logs with an arbitrary level.

**Parameters:**

- `$level` (mixed)
- `$message` (string)
- `$context` (array)

**Returns:**

- (void)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~167 days

Total

4

Last Release

556d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ad62c8d0e69358fd63b16fdaa71d5359231cd0cf660bbc3419071dc705c63a8?d=identicon)[bayfrontmedia](/maintainers/bayfrontmedia)

---

Top Contributors

[![robinsonjohn](https://avatars.githubusercontent.com/u/24327848?v=4)](https://github.com/robinsonjohn "robinsonjohn (6 commits)")

---

Tags

logphploggermonolog

### Embed Badge

![Health badge](/badges/bayfrontmedia-multi-logger/health.svg)

```
[![Health](https://phpackages.com/badges/bayfrontmedia-multi-logger/health.svg)](https://phpackages.com/packages/bayfrontmedia-multi-logger)
```

###  Alternatives

[logtail/monolog-logtail

Logtail handler for Monolog

243.6M3](/packages/logtail-monolog-logtail)[theorchard/monolog-cascade

Monolog extension to configure multiple loggers in the blink of an eye and access them from anywhere

1482.2M9](/packages/theorchard-monolog-cascade)[inpsyde/wonolog

Monolog-based logging package for WordPress.

184637.3k7](/packages/inpsyde-wonolog)[glopgar/monolog-timer-processor

A processor for Monolog that adds timing info to the message contexts

1570.6k](/packages/glopgar-monolog-timer-processor)[yzen.dev/mono-processor

This Processor will display in the logs bread crumbs by which you can more quickly and accurately identify the cause of the error.

116.1k](/packages/yzendev-mono-processor)

PHPackages © 2026

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