PHP code example of comphp / logging
1. Go to this page and download the library: Download comphp/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/ */
comphp / logging example snippets
Neuron\Logging\LogManager;
use Neuron\Logging\LogLevel;
use Neuron\Logging\Loggers\FileLogger;
// Initialize the log manager
$logManager = new LogManager($container);
$logManager->load(ThirdPartyFileLogger::class, [
'filePath' => __DIR__ . '/logs/app.log',
'supported' => [LogLevel::INFO, LogLevel::WARNING, LogLevel::ERROR],
])
// Dispatch some log messages
$logManager->info("Application started", ['user' => 'Alice']);
$logManager->error("Unhandled exception", ['exception' => 'RuntimeException']);