1. Go to this page and download the library: Download dadapas/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/ */
dadapas / log example snippets
use Dadapas\Log\{FileSystemAdapter, Log as Logger};
$localAdapter = new \League\Flysystem\Local\LocalFilesystemAdapter(
// Determine log directory
__DIR__.'/path/to/logs'
);
// The FilesystemOperator
$filesystem = new \League\Flysystem\Filesystem($localAdapter);
$filesysAdapter = new FileSystemAdapter($filesystem);
$logger = new Logger();
$logger->setAdapter($filesysAdapter);
// ...
use Dadapas\Log\PHPMailerAdapter;
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
$mail = new PHPMailer(true);
// $mail->SMTPDebug = SMTP::DEBUG_SERVER;
// $mail->isSMTP();
// $mail->Host = 'smtp.example.com';
// $mail->SMTPAuth = true;
// ...
$adapter = new PHPMailerAdapter($mail);
// ...
$logger->setAdapter($adapter);
// ...
try {
throw new Exception("An exception has been thrown.");
} catch (Exception $e) {
// Log to the the error message to file
$logger->error($e->getMessage(), $e->getTrace());
} catch (\PHPMailer\PHPMailer\Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.