PHP code example of cruxoft / logbook

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

    

cruxoft / logbook example snippets


use Cruxoft\Logbook;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;

// Generate one or more handlers
$handler = new StreamHandler("./sample.log", Logger::ERROR);

// Add a log channel with specified handlers, optional processors can also be added
Logbook::add("my_log_channel", array($handler));

// Raising a log, standard monolog methods can be used eg. error() err(), addError()
Logbook::get("my_log_channel")->error("This is just an example");