1. Go to this page and download the library: Download veronalabs/logger-wp 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/ */
veronalabs / logger-wp example snippets
use LoggerWp\Logger;
// create a log channel
$logger = new Logger([
'dir_name' => 'wpsms-logs', // wp-content/uploads/wpsms-logs/plugin-2022-06-11-37718a3a6b5ee53761291cf86edc9e10.log
'channel' => 'plugin', // default dev
'logs_days' => 30
]);
$logger->warning('Foo');
$logger->warning('Foo with context', [
'name' => 'Sarah',
'age' => '23',
]);
$logger->setChannel('api'); // wp-content/uploads/wpsms-logs/api-2022-06-11-37718a3a6b5ee53761291cf86edc9e10
$logger->error('Twilio encountered issue!');
use LoggerWp\Exception\LogerException;
try {
throw new LogerException('API error!');
} catch (Exception $e) {
}
use LoggerWp\Logger;
try {
throw new Exception('API error!');
} catch (Exception $e) {
Logger::getInstance()->warning($e->getMessage());
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.