lucite / mocklogger
v0.0.3
2024-09-24 06:39 UTC
Requires
- psr/log: ^3.0
Requires (Dev)
- laravel/pint: ^1.17
- phpunit/phpunit: ^11.3
README
A simple psr3 implementation meant for unit testing.
Installation
composer require lucite/mocklogger
Usage
Instead of writing messages somewhere, all messages are pushed onto an array (->logs). Messages are prepended with [$LEVEL]
where $LEVEL is the all caps name of the function used to log the message. The $context arg is simply json_encoded and appended onto the message.
There are a number of handy utility functions that could be useful for testing:
->count()
returns the number of messages that have been logged.->reset()
clears the log array.->last()
returns the most recently logged message