Skip to content

gregoryv/php-logger

Repository files navigation

Build Status Code Climate Test Coverage

Flattr this git repo

README

Logger module for basic intuitive logging in php. Severity levels are based on those for syslog found in RFC5424. This module is a starting point from which you can evolve your logging needs as your system grows. The simplest and default way of using it is

use gregoryv\logger\Logger;

$log = new Logger();
$log->info('something');

$x = 'something';
$log->debugf('Variable $x=%s', $x);

$log->turn('off debug'); // for this logger only
$log->debug('this will not be written');

$log->turn('off all warn'); // for this and all subsequently created loggers

The logger has methods for each severity level defined by RFC5424 6.2.1. That means you do not care much about where the messages end up initially, which surprisingly, is in the syslog.

Design

Usage

Add to your composer.json

{
  "require": {
    "gregoryv/php-logger": "*"
  }
}