PHP code example of kombyte / simple-logger

1. Go to this page and download the library: Download kombyte/simple-logger library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kombyte / simple-logger example snippets


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');

use SimpleLogger\streams\LogStream;

class MyStream implements LogStream
{
    public function write(LogResult $message): void
    {
        // Write the message
    }
}