repejota/monolog-nats

A Monolog NATS handler.

0.0.11 2017-10-22 19:14 UTC

This package is not auto-updated.

Last update: 2024-11-24 05:03:08 UTC


README

Monolog handler for sending logs to NATS (http://nats.io). Useful for async recording those logs on another machine.

  • Develop CircleCI

  • Master CircleCI

  • Coverage Coverage Status

Install

composer require repejota/monolog-nats

This will install this package itself Monolog and PHPNAts, if they are not yet installed.

Example

<?php
require_once __DIR__.'/../vendor/autoload.php';

use Nats\Connection;

use Monolog\Logger;
use Monolog\Handler\NatsHandler;

$nats = new Connection();
$nats->connect();

$logger = new Logger("monolog-nats-logger");
$natsHandler = new NatsHandler($nats);
$logger->pushHandler($natsHandler);

$logger->info("Info log");