PHP code example of h22k / logma

1. Go to this page and download the library: Download h22k/logma 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/ */

    

h22k / logma example snippets




use H22k\Logma\Formatter\PlainTextFormatter;
use H22k\Logma\Logma;
use H22k\Logma\Resource\StreamResource;
use H22k\Logma\Source\StreamSource;

$logma = new Logma(
    'logma',
);

$source = new StreamSource(
    new StreamResource(__DIR__.'/storage/test.log'), 
    new PlainTextFormatter());

$logma->addSource($source);

$logma->info('first log'); 
// OUTPUT: [29/04/24 07:18:48] logmaTest.INFO | first log a:0:{}