| Ratings |   | Unique User Downloads |   | Download Rankings | 
| Not enough user ratings |  | Total: 51  |  | All time:  10,692 This week: 55  | 
Example
<?php 
 
declare (strict_types=1); 
 
use SimpleLogger\Logger; 
use SimpleLogger\streams\{CollectionStream, FileStream, StdoutStream}; 
 
require __DIR__ . '/vendor/autoload.php'; 
 
$logger = new Logger(stream: new CollectionStream([ 
    new StdoutStream(), 
    FileStream::async(__DIR__ . '/log.log'), 
])); 
 
$logger->info('This is an info message', ['exception' => new Exception('This is an exception')]); 
$logger->warning('This is a warning message'); 
$logger->debug('This is a debug message with {msg}', ['msg' => 'parameters']); 
 
 | 
 
Details
Simple psr logger
Installation
composer require mateodioev/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
    }
}
 
 
|   | 
Applications that use this package | 
  | 
No pages of applications that use this class were specified.
 If you know an application of this package, send a message to the author to add a link here.