2017 © Pedro Peláez
 

library monoconf

log4j like logging configuration for the monolog framework

image

0x20h/monoconf

log4j like logging configuration for the monolog framework

  • Tuesday, August 16, 2016
  • by 0x20h
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9,730 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 8 % Grown

The README.md

Monoconf

log4j like configuration for the monolog logging framework., (*1)

Usage

  1. Create a config JSON file:

``` json { "rules": { "": { "error": { "handler": ["error-handler"] } }, "MyApp\Controller": { "debug": { "handler": ["debug-handler"], "processor": ["pid"] }, "error": { "handler": ["error-handler"] } } }, "handler": { "error-handler": { "type": "Monolog\Handler\StreamHandler", "args": [ "/my/app/error.log" ], "formatter": "line" }, "debug-handler": { "type": "Monolog\Handler\StreamHandler", "args": [ "/my/app/application.log" ], "formatter": "line" } }, "formatter": { "line": { "type": "Monolog\Formatter\LineFormatter", "args": [ "%datetime% %pid% %channel%@%level_name% %message% %context%\n" ] } }, "processor": { "pid": { "type": "Monolog\Processor\ProcessIdProcessor", "args": [ ] } } }, (*2)


2. In your application: ``` php require 'vendor/autoload.php'; use Monoconf\Monoconf; // initialize monoconf Monoconf::config(json_decode(file_get_contents('monoconf.json'), true));

``` php namespace MyApp\Controller;, (*3)

class SomeController {, (*4)

protected $Log;

public function __construct() {
    self::$Log = \Monoconf\Monoconf::getLogger(__CLASS__);
}

public function someAction()
{
    self::$Log->debug(__METHOD__.' called');
}

}, (*5)


Using this setup every class in the `MyApp\Controller` namespace will get a logger that logs every message up to `debug` to `/my/app/error.log` and every other class will get a logger that logs messages up to `error` to `/my/app/error.log`. ## Tests

phpunit --bootstrap tests/bootstrap.php tests/ ```, (*6)

The Versions

16/08 2016

dev-revise

dev-revise

log4j like logging configuration for the monolog framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar 0x20h

logging monolog

17/08 2013

dev-pimple

dev-pimple

log4j like logging configuration for the monolog framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar 0x20h

logging monolog

06/06 2013

dev-master

9999999-dev

log4j like logging configuration for the monolog framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar 0x20h

logging monolog

06/06 2013

0.1.1

0.1.1.0

log4j like logging configuration for the monolog framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar 0x20h

logging monolog

03/06 2013

v0.1.1-rc1

0.1.1.0-RC1

log4j like logging configuration for the monolog framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar 0x20h

logging monolog

03/06 2013

v0.1.0

0.1.0.0

log4j like logging configuration for the monolog framework

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar 0x20h

logging monolog