kephp/log4php-helper

Support a trait class to embed to your any php class to let them can be loggable.

1.0.2 2020-06-18 03:33 UTC

This package is not auto-updated.

Last update: 2024-04-19 17:26:39 UTC


README

Support a trait class to embed to your any php class to let them can be loggable.

log4php quickstart

Install

composer require kephp/log4php-helper

How to use

How to configure the Log4php env


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) and LoggableTrait::filterLoggerName($name) will try to transform \ (PHP class namespace spr) to . .