lezhnev74/monolog-async-handler

Sends monolog notifications via given closure

Installs: 6 415

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 1

Forks: 1

Open Issues: 0

pkg:composer/lezhnev74/monolog-async-handler

1.0 2016-01-30 13:30 UTC

This package is auto-updated.

Last update: 2025-09-29 01:43:45 UTC


README

Packagist Build Status Total Downloads

Handler for monolog to handle log writing through closure. Inside the closure you can set pushing to queues.

Example usage

use lezhnev74\Monolog\Handler\ClosureHandler;
use Monolog\Logger;

$handler = new ClosureHandler(function ($record) {
    // put your data to queue
    // or any other logic goes here that detaches the logging from life circle
    
    /* 
    the $record contains:
    
    [
        "message"    => "the message goes here",
        "context"    => ["platform" => "ios"], // context
        "level"      => 200,
        "level_name" => "INFO",
        "channel"    => "local",
        "datetime"   => "",
        "extra"      => [],
        "formatted"  => "[2016-01-30 15:41:37] local.INFO: FORMATTED MESSAGE GOES HERE []\n",
    ]
    */
});
$monolog = new Logger('async_logger');
$monolog->pushHandler($handler);

Installation

composer require lezhnev74/monolog-async-handler