Skip to content

Factory class that takes string arguments to build and return a Monolog handler

License

Notifications You must be signed in to change notification settings

wa0x6e/Monolog-Init

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Monolog-Init

Very basic and light Dependency Injector Container for Monolog

Helps create the following handler

  • Cube
  • RotatingFile
  • ChromePHP
  • Syslog
  • Socket
  • MongoDB
  • CouchDB
  • HipChat
  • PushOver
  • ZendMonitor
  • Stream
  • Redis

from 2 strings : <handlerName> <comma-separated list of arguments>

The second argument will be split, and pass to the handler __construct().

Usage

Download and include the MonologInit class in your code, or install it via Composer.

Usage example :

$logger = new MonologInit('Cube', 'udp://127.0.0.1:1080');

To pass more than one parameter, separate them with a comma

$logger = new MonologInit('Cube', 'udp://127.0.0.1:1080,0,1');

And use it like that :

$logger->getInstance()->addInfo('hi ! This is my first log');

Where to use

This container is usefull for creating remote log, for instance via CLI, where you can't pass object.

There is already a SymfonyBundle that does the same thing, but it's … very heavy.

About

Factory class that takes string arguments to build and return a Monolog handler

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages