1. Go to this page and download the library: Download faslatam/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/ */
faslatam / log example snippets
$logger = new Forestry\Log\Log('/tmp/dummy.log');
//Just log notices and above.
$errorLog = new Forestry\Log\Log('./logs/error.log', Psr\Log\LogLevel::NOTICE);
$factory = new ErrorLogger();
$logger = $factory->create('/tmp/error.log');
$logger->emergency('This is an emergency message');
$logger->alert('This is an alert message');
$logger->critical('This is an critical message');
$logger->error('This is an error message');
$logger->warning('This is an warning message');
$logger->notice('This is a notice message');
$logger->info('This is an information');
$logger->debug('This is a debug message');
$logger->log(Psr\Log\LogLevel::DEBUG, 'this is a debug message');
$user = ['name' => 'John Doe', 'mail' => '[email protected]'];
$logger->info('Send mail to {name} ({mail})', $user); // Send mail to John Doe ([email protected])
$logger->setDateFormat('r'); // e.g. Thu, 21 Dec 2000 16:01:07 +0200
$logger->setLogFormat('[{level}|{date}] {message}'); // [INF0|2013-04-25 13:37:42] This is an info message