PHP code example of linio / microlog

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

    

linio / microlog example snippets




declare(strict_types=1);

use Linio\Component\Microlog\Log;
use Monolog\Handler\StreamHandler;

// Register a logger for a channel
$defaultLogger = new StreamHandler();
Log::setLoggerForChannel($defaultLogger, Log::DEFAULT_CHANNEL);

// Log an emergency
Log::emergency('This is a test emergency');

// Log an alert
Log::alert('This is a test alert');

// Log a critical error
Log::critical('This is a test critical error');

// Log an error
Log::error('This is a test error');

// Log a warning
Log::warning('This is a test warning');

// Log a notice
Log::notice('This is a test notice');

// Log a bit of information
Log::info('This is test information');

// Log debug information
Log::debug('This is test debug information');

// Log at an arbitrary level
Log::log('emergency', 'This is a test entry at an arbitrary level of emergency');



declare(strict_types=1);

use Linio\Component\Microlog\Log;
use Monolog\Handler\StreamHandler;

$defaultLogger = new NullLogger();
Log::setLoggerForChannel($defaultLogger, 'emergency');

Log::emergency('This is an emergency in the emergency channel', 'emergency');