noccylabs/tinylog

$ git tag
0.1.0

$ git branch
* master

TinyLog: A Tiny Logger

This logger is intended for use in projects where the most exellent Monolog and friends might be too much. Setup is simple, and even optional if all you really need is to log messages to the console.

Messages are sent from the main Logger to the registered sinks. To make things even easier, the sink can be either a function/closure, or an implementation of the LoggerSinkInterface.

Included sinks

Examples

use NoccyLabs\TinyLog\Logger;
use NoccyLabs\TinyLog\ConsoleSink;

$logger = new Logger();

// This message will be written to the console withot markup.
$logger->info("I'm logged without a sink!");

// Adding a sink using an anonymous function
$logger->addSink(function ($level, $message, $context) {
    printf("%s: %s\n", $level, $message);
});

// Adding a sink from a class
$logger->addSink(new ConsoleSink());

// This now goes to both the function and the ConsoleSink
$logger->debug("Hello World");