2017 © Pedro Peláez
 

library logger

PSR-3 Logger implementation for handling PHP streams.

image

phpmake/logger

PSR-3 Logger implementation for handling PHP streams.

  • Saturday, May 3, 2014
  • by oasynnoum
  • Repository
  • 1 Watchers
  • 0 Stars
  • 134 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

phpmake_logger

PSR-3 Logger implementation for handling PHP streams., (*1)

API

Instantiate

default logger

Default logger outputs logs to stdout., (*2)

<?php
require_once 'PHPMake/Logger.php';
$defaultLogger = new \PHPMake\Logger();

Next line is equal to above., (*3)

$defaultLogger = new \PHPMake\Logger('php://stdout');

file appender

Constructor's first argument can be specified URL, then, logger outputs logs to the specified URL., (*4)

$fileAppender = new \PHPMake\Logger('file:///tmp/app.log');
// or
// $fileAppender = new \PHPMake\Logger('file:///tmp/app.log', 'a');

Constructor's second argument can be specified file opening mode. Default mode is a which means to 'append'.
If you passed w as second argument, specified file will be empty at first. Or passed r, you will get warnings when each output., (*5)

Logging

This logger implements \Psr\Log\Logger interface. Therefore, call these methods for logging., (*6)

$logger->debug('debug');
$logger->info('info');
$logger->notice('notice');
$logger->warning('warning');
$logger->error('error');
$logger->critical('critical');
$logger->alert('alert');
$logger->emergency('emergency');

threshold

setThreshold() method is provide to control outputs with log level., (*7)

$logger = new \PHPMake\Logger();
$logger->setThreshold(\Psr\Log\LogLevel::WARNING);

// debug, info and notice will not be output.
$logger->debug('debug');
$logger->info('info');
$logger->notice('notice');

// level which is warning or higher will be outputted.
$logger->warning('warning');
$logger->error('error');
$logger->critical('critical');
$logger->alert('alert');
$logger->emergency('emergency');

The Versions

03/05 2014

dev-master

9999999-dev

PSR-3 Logger implementation for handling PHP streams.

  Sources   Download

The Requires

 

03/05 2014

v0.1.0

0.1.0.0

PSR-3 Logger implementation for handling PHP streams.

  Sources   Download

The Requires