exewen / logger
A logger component for Exewen.
v2.0.3
2025-03-24 06:55 UTC
Requires
- php: >=7.3
- exewen/di: ^2
- monolog/monolog: ^1.24 || ^2.0 || ^3.1
Requires (Dev)
- phpunit/phpunit: ^5.7 | ^6.5 | ^7.5 | ^8.4 | ^9.3
README
composer require exewen/logger
复制配置
cp -rf ./publish/exewen /your_project/config
初始化
!defined('BASE_PATH_PKG') && define('BASE_PATH_PKG', dirname(__DIR__, 1));
写入日志
# 初始化DI $app = ApplicationContext::getContainer(); $app->setProviders([LoggerProvider::class]); $this->app = $app; /** @var LoggerInterface $logger */ $logger = $this->app->get(LoggerInterface::class); $logger->info("info日志"); $logger->debug("debug日志"); $logger->error("error日志");
使用 facades
composer require exewen/facades
# info LoggerFacade::info("info日志"); # error LoggerFacade::error("error日志"); # warning LoggerFacade::warning("warning日志"); # notice LoggerFacade::notice("notice日志"); # debug LoggerFacade::debug("debug日志"); # request LoggerFacade::request("request日志");