1. Go to this page and download the library: Download radphp/logging 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/ */
radphp / logging example snippets
use Rad\Logging\Logger;
use Rad\Logging\Adapter\FileAdapter;
// Attach single or multiple adapters
$logger = new Logger();
$logger->attachAdapter(new NullAdapter());
$logger->attachAdapter(new FileAdapter('/path/to/file.log'));
// Or attaching your adapter
$logger->attachAdapter(new MyAdapter());
// You can pass message to these log levels
$logger->emergency('Something did not work');
$logger->alert('Something did not work');
$logger->critical('Something did not work');
$logger->error('Something did not work');
$logger->warning('Something did not work');
$logger->notice('Something did not work');
$logger->info('Something did not work');
$logger->debug('Something did not work');
use Rad\Logging\Logger;
use Rad\Logging\Adapter\FileAdapter;
$logger = new Logger();
$logger->attachAdapter(new FileAdapter('/path/to/file.log'));
$logger->info('User "{user_id}" successfully logged in.', ['user_id' => 2]);
use Rad\Logging\Logger;
use Rad\Logging\Adapter\FileAdapter;
$logger = new Logger();
$logger->attachAdapter(new FileAdapter('/path/to/file.log'));
$logger->begin();
try {
//Code here
$logger->commit();
} catch (\Exception $e) {
$logger->rollback();
throw $e;
}
use Rad\Logging\Logger;
use Rad\Logging\Adapter\FileAdapter;
$logger = new Logger();
$fileAdapter = new FileAdapter('/path/to/file.log');
$fileAdapter->setFormatter(new LineFormatter("%time% :: {%level%} :: %message%\n", 'G:i:s T'));
$logger->attachAdapter($fileAdapter);
$logger->emergency('Something did not work');
$logger->alert('Something did not work');
09/Apr/2016 11:18:55 UTC [EMERGENCY] Something did not work
09/Apr/2016 11:18:55 UTC [ALERT] Something did not work
09/Apr/2016 11:18:55 UTC [CRITICAL] Something did not work
09/Apr/2016 11:18:55 UTC [ERROR] Something did not work
09/Apr/2016 11:18:55 UTC [WARNING] Something did not work
09/Apr/2016 11:18:55 UTC [NOTICE] Something did not work
09/Apr/2016 11:18:55 UTC [INFO] Something did not work
09/Apr/2016 11:18:55 UTC [DEBUG] Something did not work
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.