Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

thekid
Copy link
Member

@thekid thekid commented Aug 24, 2018

See #11 (comment)

Configuration

[default]
uses=console|syslog|files

[console]
class=util.log.ConsoleAppender
level=ALL

[files]
class=util.log.FileAppender
args="/var/log/server.log"
level=ALL

[syslog]
class=util.log.SyslogUdpAppender
args=127.0.0.1|514|server
level=WARN|ERROR

API

$c= new LogConfiguration(new Properties('log.ini'));
$cat= $c->category('default');   // Returns console, syslog and files
$cat= $c->category('syslog');    // An appender as configured by "syslog"

$all= $c->categories();  // ["default" => new LogCategory()->withAppenders(...), "syslog" => ...

$name= 'does-not-exist';
$exists= $c->provides($name);    // FALSE
$cat= $c->category($name);       // ***lang.IllegalArgumentException***

Migration

- $l= Logger::getInstance();
- $l->configure(new Properties('log.ini'));
- $cat= $l->getCategory('default');
+ $c= new LogConfiguration(new Properties('log.ini'));
+ $cat= $c->category('default'); 

@thekid thekid merged commit bd50eee into master Aug 24, 2018
@thekid thekid deleted the feature/logconfig branch August 24, 2018 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant