galvao-eti/monolog-wrapper

A wrapper around Monolog that implements a few standards and provides a decent level of customization.

1.0 2025-07-09 00:51 UTC

This package is auto-updated.

Last update: 2025-07-09 00:51:43 UTC


README

A wrapper around monolog that implements a few common standards, such as:

  • A single folder path where log files are stored;
  • Using dates (Y-m-d) as a filename;
  • A pattern for log lines that prioritizes severity and time first.

while also letting you add as many streams and processors as you wish.

Installation

composer require galvao-eti/monolog-wrapper

Usage

use GalvaoEti\MonologWrapper;

// If you wish to add streams and/or processors just add them to the static attributes:
MonologWrapper::$streams['streamName'] = 'streamSeverity';
MonologWrapper::$processors[] = new \Monolog\Processor\WebProcessor(null, [
    'ip' => 'REMOTE_ADDR',
    'referrer' => 'HTTP_REFERER',
    'method' => 'REQUEST_METHOD',
]);

$logger = MonologWrapper::getInstance();

// From here onwards just use Moolog's own methods, such as debug(), info(), etc...

Credits

Made for Galvão Desenvolvimento Ltda. by Er Galvão Abbott.