PHP code example of azay / json-logger
1. Go to this page and download the library: Download azay/json-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/ */
azay / json-logger example snippets
use Azay\Log\JsonLogger;
/tmp/logger',
JsonLogger::DEFAULT_JSON_OPTIONS, // JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
JsonLogger::DEFAULT_TIME_FORMAT // 'Y-m-d H:i:s'
);
//Optional, set maximum severity level, default `debug`
$logger->setLevel('info');
// or as constant
$logger->setLevel($logger::INFO);
$logger->info(
'Info message for json logger',
[
'Foo' => 'Bar'
]
);
// This message will be ignored by severity
$logger->debug(
'Verbose debug message',
[
'details' => 'Lorem ipsum...'
]
);