PHP code example of bvdputte / kirby-log

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

    

bvdputte / kirby-log example snippets


$site->log("message", "level" /* optional */, "appendcontext" /* optional */);

$site->log("This text will be added to the default log");

$site->log("My message", "error");

$arr = ["foo", "bar", "baz"];
$site->log("My message", "debug", $arr);

$site->logger("logname", "options" /* optional */, "defaultlevel" /* optional */)->log("message", "level" /* optional */, "appendcontext" /* optional */);

$site->logger("my-own-logfile.log")->log("This event will be added to my custom named logfile");

$options = [
    'dateFormat'     => 'Y-m-d G:i:s.u',
    'logFormat'      => false,
    'appendContext'  => true,
];
$site->logger("infolog.log", $options)->log("Info about something", "info");