rost / logger
There is no license information available for the latest version (dev-main) of this package.
Simple psr-3 logger with Factory and Singleton patterns implementation
dev-main
2022-12-07 18:46 UTC
Requires
- php: >=8.1
- devcoder-xyz/php-dotenv: ^1.1
- psr/log: ^3.0
This package is auto-updated.
Last update: 2025-03-07 23:51:33 UTC
README
Simple psr-3 logger with Factory and Singleton patterns implementation
Installation
composer require rost/logger
Requirements
- PHP 8.1
- psr/log 3.0
How to use ?
namespace Simple\Logger; use DevCoder\DotEnv; require_once 'vendor/autoload.php'; $absolutePathToEnvFile = DIR . '/.env'; (new DotEnv($absolutePathToEnvFile))->load(); $filename = dirname(FILE) . DIRECTORY_SEPARATOR . 'var' . DIRECTORY_SEPARATOR . 'log' . DIRECTORY_SEPARATOR . 'test.log'; $handler = Handlers\Factories\HandlerFactoryHelper::getHandlerFactory(getenv('FILE_HANDLER_FACTORY'))::create(); $handler->settings($filename); $logger = \Simple\Logger\Logger\Logger::getInstance(); $logger->settings($handler); $logger->log(\Psr\Log\LogLevel::EMERGENCY, 'test');