mateodioev / simple-logger
Simple PSR logger for PHP
v1.0.0
2026-03-22 02:12 UTC
Requires
- php: >=8.4
- php-parallel-lint/php-console-color: ^1.0
- psr/log: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.52
Suggests
- amphp/file: To enable async file writing
- php-parallel-lint/php-console-color: To enable colored output in the terminal
This package is auto-updated.
Last update: 2026-03-22 04:14:50 UTC
README
Installation
composer require kombyte/simple-logger
Usage
use SimpleLogger\Logger; use SimpleLogger\streams\{CollectionStream, FileStream, StdoutStream}; $logger = new Logger(stream: new CollectionStream([ new StdoutStream(), FileStream::async(__DIR__ . '/log.log'), ])); $logger->debug('The debug message');
Creating a new stream
A stream is a class that implements the SimpleLogger\streams\LogStream interface. You can create your own stream by implementing the write method.
use SimpleLogger\streams\LogStream; class MyStream implements LogStream { public function write(LogResult $message): void { // Write the message } }