PSR-3 compliant lol-gger
Use composer:
composer require PHPointless/monolol
Monolol provide new wrapper handler for Monolog : LolHandler. LolHandler will apply a Lolifier that will do some stuff on records handled by wrapped handler.
For example, we want to randomly shuffle log message words of all records that will be handled by a Monolog StreamHandler. Here is the code that will do the trick:
<?php
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Monolol\Handlers\LolHandler;
use Monolol\Lolifiers;
$logger = new Logger('myLog');
$streamHandler = new StreamHandler(__DIR__ . '/monolol.log');
$lolHandler = new LolHandler($streamHandler, new Lolifiers\Shuffle());
$logger->pushHandler($lolHandler);
$logger->info('My littlest pony');
$logger->error('This burger has no cheese');
- Shuffle: Words contained in record message will be randomly shuffled
- Confuse: This lolifier will change randomly the log level of the record
- GeekTime: Records will be handled only if it's 1:37pm (13:37)
- Hangman: Wants to play hangman game while reading your logfiles ?
- Hash: records message will be hashed with an algorithm randomly chosen
- LaMerNoire: records message will be replaced by the following string : 'La mer Noire'
- Mirror: records message content will be reversed (desrever eb lliw tnetnoc egassem sdrocer)
- NotGiveAFuck: message of records having loglevel above INFO will be replaced by the following string : "It seems that your application has encountered an issue. But as we don't give a fuck, we will not tell you what the problem is. Have a good day"
- Quote: records message will be replaced by a quote randomly chosen. Quote Lolifier needs a QuoteProvider. Here's an example of how to use it :
$quoteProvider = new Lolifiers\QuoteProviders\Kaamelott\Kadoc();
$lolHandler = new LolHandler($streamHandler, new Lolifiers\Quote($quoteProvider));
If you want quotes from more than one provider, you can use QuoteProviders\Collection
$quoteProvider = new Lolifiers\QuoteProviders\Collection();
$quoteProvider->add(new Lolifiers\QuoteProviders\Kaamelott\Kadoc())
->add(new Lolifiers\QuoteProviders\Kaamelott\Karadoc())
->add(new Lolifiers\QuoteProviders\Kaamelott\Perceval());
$lolHandler = new LolHandler($streamHandler, new Lolifiers\Quote($quoteProvider));
- Warp: handle records will travel through the Warp
- Yell: TO READ YOUR LOG FILES IN NOISY ENVIRONMENTS
- Yolo: "An error? What are you talking about? There was no error!". All records having loglevel above INFO will not be handled
- Tourette: Monolog is suffering a Tourette's syndrom. This lolifier needs a SwearWordsProvider. Here's an example of how to use it :
$swearWordsProvider = new Lolifiers\SwearWordsProviders\DefaultProvider();
$lolHandler = new LolHandler($streamHandler, new Lolifiers\Tourette($swearWordsProvider));