Skip to content

reactphp-x/log

Repository files navigation

wpjscc/reactphp-log

reactphp is a collection of event-driven libraries for PHP designed with fibers and concurrency in mind. reactphp-x/log provides a non-blocking stream handler for monolog/monolog.

Release License

Installation

This package can be installed as a Composer dependency.

composer require reactphp-x/log -vvv

Usage

<?php

use React\Stream;
use ReactphpX\Log\ConsoleFormatter;
use ReactphpX\Log\StreamHandler;
use ReactphpX\Log\FileWriteStream;
use Monolog\Logger;

require dirname(__DIR__) . '/vendor/autoload.php';

// $handler = new StreamHandler(new FileWriteStream(__DIR__ . '/example.log'));

// Here we'll log to the standard output stream of the current process:
$handler = new StreamHandler(new Stream\WritableResourceStream(STDOUT));
$handler->setFormatter(new ConsoleFormatter);

$logger = new Logger('main');
$logger->pushHandler($handler);

$logger->debug("Hello, world!");
$logger->info("Hello, world!");
$logger->notice("Hello, world!");
$logger->error("Hello, world!");
$logger->alert("Hello, world!");

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages