Monolol
PSR-3 compliant lol-gger, (*1)
QA
, (*2)
, (*3)
INSTALLATION
Use composer:, (*4)
composer require PHPointless/monolol
HOW TO USE IT
Monolol provides a new wrapper handler for Monolog: LolHandler.
LolHandler will apply a Lolifier that will do some stuff on records handled by the wrapped handler., (*5)
For example, we want to randomly shuffle the log message words of all records that will be handled by a Monolog StreamHandler.
Here is code that will do the trick:, (*6)
<?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');
AVAILABLE LOLIFIERS
-
Blackout: Forgot half the sentence
-
Shuffle: Words contained in the 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: Want to play hangman game while reading your logfiles?
-
Hash: Messages will be hashed with a randomly chosen algorithm
-
LaMerNoire: Messages will be replaced by the following string: 'La mer Noire'
-
Mirror: Messages' content will be reversed (desrever eb lliw tnetnoc egassem sdrocer)
-
NotGiveAFuck: Messages 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"
-
NyanCat: Nya nya nya nya nya nya nya nya nya nya nya!
-
Quote: Messages 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:, (*7)
$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: Handled 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 from Tourette's syndrome. 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));