UltrosBot / Ultros

Connecting communities, one squid at a time! Ultros is a multi-protocol chat bot written in Python, designed with both the user and developer in mind
http://ultros.io
Artistic License 2.0
23 stars 7 forks source link

Logging changes #77

Open gdude2002 opened 9 years ago

gdude2002 commented 9 years ago

As requested..

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/25783132-logging-changes?utm_campaign=plugin&utm_content=tracker%2F269930&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F269930&utm_medium=issues&utm_source=github).
rakiru commented 9 years ago

Solution: revert logbook

gdude2002 commented 9 years ago

A lot of the things Logbook provides are nice, but until it was used it was hard to see how/if it'd suit things, and well, I'm not so sure now. And I can't remember why I decided to use it.

We do still need a logging system; if we're going to plan a new one, let's actually plan it out this time.

rakiru commented 9 years ago

So, the plan is to use standard library logging; it provides everything we need, unlike logbook.

What requirements do we have? Children/inheritance is a native concept in logging, so that's not an issue. Log rotating is also supported by using a TimedRotatingFileHandler handler, which the example/default config can be set up with. There are also handlers for SMTP, HTTP, syslog, and some other stuff. Is there anything else we'd want to offer? Personally, all I need is TimedRotatingFileHandler and inheritance.

gdude2002 commented 9 years ago

Define "inheritance" - One thing I like about logbook is the stack of handlers model it does. Would it be similar to that?

rakiru commented 9 years ago

I can configure the plugins logger to log to plugins.log or something, then plugins.urls and plugins.urltools would also go in there. I could also override plugins.web to save to web.log as well as or instead of plugins.log. It's a tree system, where each node inherits from its parent.

That's a basic example, but logbook doesn't have that concept built in. They have LoggingGroup, but that's a one-level thing (well, you may be able to nest them within each other) and it's defined in code; the logger name has no influence over it, which is silly when loggers are named in an organised tree already.

gdude2002 commented 9 years ago

Ah, yeah, I see, that does make sense.

Can we integrate this with metrics as well? I mean, builtin logging has an exception logging call, right?

rakiru commented 9 years ago

We could make a MetricsHandler that submits to metrics, yeah. If you specify it as a handler for the root node, every other logger will get it.