PHP code example of netpromotion / lazy-logger

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

    

netpromotion / lazy-logger example snippets


 // entry-point.php

$logger = new Netpromotion\LazyLogger\LazyLogger(function () {
    return Symfony::getInstance()->getContainer()->get('logger');
});

try {
    doSomething();
    exit(0);
} catch (Exception $e) {
    $logger->error('Something went wrong.', [
        'message' => $e->getMessage(),
    ]);
    exit(-1);
}