Search by

linkfast / exengine-monolog

gchiappe

Monolog logger extension for the ExEngine microframework.

Package info

gitlab.com/linkfast/oss/exengine-extensions/exengine-monolog

Issues

Type:exengine-extension

pkg:composer/linkfast/exengine-monolog

Statistics

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 0

1.0.0 2026-10-10 01:02 UTC

This package is not auto-updated.

Last update: 2026-10-11 17:45:43 UTC


README

Uses Monolog as the logger of the ExEngine microframework.

© LinkFast S.A. (https://linkfast.io) · MIT License

Requirements

  • PHP 8.1 or higher
  • ExEngine 1.3 or higher
  • Monolog 2.9 or 3.x (installed automatically)

Installation

With the ExEngine CLI (exen, in development):

exen extension:add linkfast/exengine-monolog

Or with Composer:

composer require linkfast/exengine-monolog

ExEngine discovers the extension automatically (Composer package type exengine-extension); there is nothing to register. With logging enabled (const EXENGINE_LOG = true; in your launcher), every ExEngine logger writes through Monolog, and the logger name becomes the Monolog channel (ExEngine.router, Orders.Payments, ...).

Configuration

In config/application.yml (or any profile file):

monolog:
  enabled: true          # false keeps the logger configured in ExEngine
  stream: php://stderr   # file path or stream URL
  level: debug           # debug, info, notice, warning, error, critical, alert, emergency
KeyDefaultDescription
monolog.enabledtrueMake Monolog the ExEngine logger
monolog.streamphp://stderrFile path or stream URL the logs are written to
monolog.leveldebugMinimum level written

Environment variables override these keys as usual (MONOLOG_LEVEL=warning, MONOLOG_STREAM=/var/log/app.log). Setting exengine.logger still takes precedence over the extension.

With RoadRunner, php://stderr ends up in the RoadRunner log.

Handlers and processors

Use the shared Monolog instance to add your own handlers or processors, for example in a Booted listener:

use ExEngine\Monolog\MonologLogger;
use Monolog\Processor\UidProcessor;

MonologLogger::monolog()->pushProcessor(new UidProcessor());

Upgrading from ExEngine 1.2

ExEngine 1.2 shipped ExEngine\Logger\MonoLogger in its core. It now lives in this package, which keeps that class name working as an alias: install the package and existing configurations keep logging. The EXENGINE\LOG_LOCATION constant is still honoured (warning level) until the monolog properties are set.

Development

Tests need PHP 8.4+ (PHPUnit 13):

composer install
php vendor/bin/phpunit

To test against a local checkout of the ExEngine core (for example before a core release), point Composer to it without committing the change:

composer config repositories.exengine '{"type": "path", "url": "../../exengine", "options": {"versions": {"linkfast/exengine": "1.3.0"}}}'
composer update linkfast/exengine

The CI does the same with the core branch or tag in the EXENGINE_REF variable (default master); leave it empty to test against the core published on Packagist.

Releasing

  1. Update CHANGELOG.md.
  2. Create an annotated tag on main, without a "v" prefix like the ExEngine core: git tag -a 1.0.0 -m "..." && git push origin 1.0.0.
  3. Packagist publishes the tag (register the repository once at https://packagist.org/packages/submit and enable the GitLab integration so new tags are picked up automatically).

License

MIT, see LICENSE.