Search by

sailantis / azera-log

lumielis

Logging companion for the Azera framework: Monolog-based logging with Azera-specific extensions (composite file rotation, console coloring) and ready-made PSR-14 listeners for database, auth, and queue events.

Package info

github.com/sailantis/azera-log

pkg:composer/sailantis/azera-log

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.4.2 2026-11-16 00:04 UTC

This package is auto-updated.

Last update: 2026-11-16 00:19:44 UTC


README

Logging companion for the Azera framework.

The framework ships only a NullLogger (PSR-3). This package builds on Monolog (the de-facto standard PSR-3 logger) and adds only the pieces Monolog does not provide:

  • Handler\RollingFileHandler — log4j-style composite (size + date), size, and date rotation. Monolog's RotatingFileHandler is date-only, so this covers the missing size/composite rotation.
  • Formatter\ConsoleFormatter + Processor\AnsiColorProcessor — selective per-level ANSI coloring for CLI output (only the level segment is colored), without a Symfony Console dependency.
  • Listeners (PSR-14): DbQueryLogger (all DB events), SlowQueryHandler (threshold-filtered QueryExecuted), TransactionAuditListener, AuthLoggerListener, QueueWorkerListener.

Everything else — the Logger, standard handlers, formatters, and processors — comes from Monolog directly. Use Monolog\Logger and push the Azera extensions onto it as you would any Monolog handler/processor.

Example

use Azera\Log\Formatter\ConsoleFormatter;
use Azera\Log\Handler\RollingFileHandler;
use Azera\Log\Processor\AnsiColorProcessor;
use Monolog\Logger;

$logger = new Logger('app');

$handler = new RollingFileHandler(
    '/var/log/app.log',
    options: ['rollingMode' => 'composite', 'maxFileSize' => 10485760],
);
$handler->setFormatter(new ConsoleFormatter());
$logger->pushHandler($handler);

$logger->pushProcessor(new AnsiColorProcessor());

Installation

composer require sailantis/azera-log

License

MIT.