Skip to content

Remove deprecated Logger #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
thekid opened this issue Aug 24, 2018 · 6 comments
Closed

Remove deprecated Logger #11

thekid opened this issue Aug 24, 2018 · 6 comments

Comments

@thekid
Copy link
Member

thekid commented Aug 24, 2018

The util.log.Logger class has been deprecated since 8.0.0; and is scheduled for removal in 9.0.0

Should there be a replacement for its configure() method? Should we adapt INI file layout at the same time?

@thekid
Copy link
Member Author

thekid commented Aug 24, 2018

See https://docs.python.org/2/library/logging.config.html

[handler_hand05]
class=handlers.SysLogHandler
level=ERROR
formatter=form05
args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER)

@johannes85
Copy link
Contributor

I think thy python ini file layout is a much better approach,

@thekid
Copy link
Member Author

thekid commented Aug 24, 2018

Idea for a really short syntax

[default]
appenders[]=util.log.ConsoleAppender("err")
appenders[]=ALL:util.log.FileAppender("/var/log/server.log")
appenders[]=WARN,ERROR:util.log.SyslogUdpAppender("127.0.0.1", 514, "server")

@johannes85
Copy link
Contributor

Your approach is also a good alternative since it is very compact but not that easy to read.

@thekid
Copy link
Member Author

thekid commented Aug 24, 2018

Mapping the Python example

Ini file

[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***

@johannes85
Copy link
Contributor

👍

thekid added a commit that referenced this issue Aug 24, 2018
thekid added a commit that referenced this issue Aug 24, 2018
@thekid thekid closed this as completed in 0d2308e Aug 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants