1. Go to this page and download the library: Download cleatsquad/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/ */
cleatsquad / logger example snippets
\CleatSquad\Logger::log('Hello!!', 'test.log');
\CleatSquad\Logger::log('Hello!!', 'test.log', \Monolog\Logger::WARNING);
\CleatSquad\Logger::log([22 => 'is an array'], 'test.log');
\CleatSquad\Logger::info(['is an array'], 'test.log');
try {
throw new \Exception('Error message');
} catch (\Exception $exception) {
\CleatSquad\Logger::critical($exception);
}
log('Hello!!', 'test.log');
log('Hello!!', 'test.log', \Monolog\Logger::WARNING);
log([22 => 'is an array'], 'test.log');
log(['is an array'], 'test.log', \Monolog\Logger::INFO);
try {
throw new \Exception('Error message');
} catch (\Exception $exception) {
log($exception);
}
[2021-11-21 14:17:44] logger.DEBUG: Hello!! [] []
[2021-11-21 14:17:44] logger.WARNING: Hello!! [] []
[2021-11-21 14:17:44] logger.DEBUG: Array ( [22] => is an array ) [] []
[2021-11-21 14:17:44] logger.INFO: Array ( [0] => is an array ) [] []