PHP code example of pivotphp / logger

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

    

pivotphp / logger example snippets


use PivotPHP\Logger\LoggerFactory;

$logger = LoggerFactory::create([
    'default' => 'daily',
    'channels' => [
        'daily' => [
            'path' => 'storage/logs/app.log',
            'days' => 14,
            'level' => 'debug',
        ],
        'stdout' => [
            'stream' => 'php://stdout',
            'level' => 'info',
            'formatter' => 'json',
        ],
    ],
]);

$logger->info('Usuário autenticado', ['user_id' => 42]);