kephp/log4php-helper

支持一个特质类,可以将它嵌入到任何PHP类中,使这些类可记录日志。

1.0.2 2020-06-18 03:33 UTC

This package is not auto-updated.

Last update: 2024-09-20 19:19:55 UTC


README

支持一个特质类,可以将它嵌入到任何PHP类中,使这些类可记录日志。

log4php 快速入门

安装

composer require kephp/log4php-helper

如何使用

如何配置 Log4php 环境


use Ke\Log\LoggableTrait;

class YoutAnyClass {
    // embed to your class
    use LoggableTrait;
}

// for use
YoutAnyClass::getStaticLogger()->trace('message');
YoutAnyClass::getStaticLogger()->debug('message');
YoutAnyClass::getStaticLogger()->info('message');

$obj = new YoutAnyClass();
$obj->getLogger('anyName')->trace('message');
$obj->trace('message');

LoggableTrait::filterStaticLoggerName($name)LoggableTrait::filterLoggerName($name) 将尝试将 \ (PHP类命名空间分隔符) 转换为 .