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

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

soflomo/log
===========

Small module to help with logging aware classes

512.2k2[2 issues](https://github.com/Soflomo/Log/issues)PHP

Since Feb 1Pushed 13y ago2 watchersCompare

[ Source](https://github.com/Soflomo/Log)[ Packagist](https://packagist.org/packages/soflomo/log)[ RSS](/packages/soflomo-log/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Soflomo\\Log
============

[](#soflomolog)

`Soflomo\Log` is a small module that provides a drop-in configuration, instantiation and initialization of a `Zend\Log\Logger` object. Its purpose it to have logging enabled in your Zend Framework 2 application with only a small configuration file. The module is opinionated with the selection of writers, but you are free to configure your own.

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

[](#installation)

`Soflomo\Log` is available through composer. Add "soflomo/log" to your composer.json list. During development of `Soflomo\Log`, you can specify the latest available version:

```
"soflomo/log": "dev-master"

```

Enable the module in your `config/application.config.php` file. Add an entry `Soflomo\Log` to the list of enabled modules. Logging should work out of the box.

Usage
-----

[](#usage)

This module provides a pre-configured instance of `Zend\Log\Logger`. The logger is connected through various writers. If you log something with the logger, it will push the message to all the writers. The writers itself check the type ("priority") of the message in order to determine whether it actually needs to perform the write. With this setup, you can write all messages (including debug messages) into a console writer (Fire-PHP or Chrome-PHP) and only write critical errors into a file stream.

To get the logger injected, make your service implement `Zend\\Log\\LoggerAwareInterface'. Then pull your service from the service manager.

```
namespace MyModule\Service;

use Zend\Log\Logger;
use Zend\Log\LoggerAwareInterface;

class MyService implements LoggerAwareInterface
{
    protected $logger;

    public function setLogger(Logger $logger)
    {
        $this->logger = $logger;
    }

    public function doSomething()
    {
        // Do your work

        if (null !== $this->logger) {
            $this->logger->info('Something done here!');
        }
    }
}
```

If the service is registered into the service manager, fetch the service and the logger is injected.

Configuration
-------------

[](#configuration)

The default configuration is a logger object with three different writers:

1. A Fire-PHP writer, used when Fire-PHP is installed;
2. A Chrome-PHP writer, used when Chrome-PHP is installed;
3. A stream writer, writing to `data/log/application.log`.

The stream writes everything from `INFO` (so only debug messages are ignored) up to `EMERG`. However, it waits for logging until an `ERROR` occurs. This means, all messages with `INFO`, `NOTICE` and `WARN` are not logged until an `ERROR` happens. This causes a slim log file with high priority messages and only informative messages when a real error occured.

Configure the behaviour of the three writers in the "writers" key. For example, to disable firephp logging and modify the path of the stream writer, put the following in a configuration file:

```
return array(
    'soflomo_log' => array(
        'writers' => array(
            'firephp' => array(
                'enabled' => false,
            ),
            'stream'  => array(
                'stream'  => 'data-something/log-else/application.log',
            ),
        ),
    ),
);
```

For all options, check the `config/module.config.php` file of this module.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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.

### Community

Maintainers

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

### Embed Badge

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

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B11.5k](/packages/psr-log)[open-telemetry/api

API for OpenTelemetry PHP.

1941.5M276](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2328.5M343](/packages/open-telemetry-sdk)

PHPackages © 2026

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