-
Notifications
You must be signed in to change notification settings - Fork 7
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
Swell logger extends logging.Logger #450
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
Though, now that you've gone through and replaced Logger(...)
with get_logger(...)
throughout (which I approve!), I think we might as well consider deprecating our custom Logger
class altogether and just teaching get_logger
to create logging.Logger
objects with the semantics we expect.
I think this makes a lot of sense, pretty much everything should be able to go through |
I tried to implement some more elegant solutions to this problem, but ended up sort of going in a circle. Logging actually doesn't seem to have very complex formatting for message levels. The implementation now at least makes better use of inheritence for the logging levels. The customization for detail is simpler now. Setting the LOGLEVEL environment variable will control the minimum priority logging level, and by default it will include messages at INFO or above. This is in line with how logging usually works. |
Is this still active and pending for a review? Figure it might have been forgotten in other numerous PRs 😃 |
Yeah, I had sort of forgotten about it too. I think I had it where I wanted it on the latest commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending one tiny fix (add a comment about what loglevel(60)
means), and assuming this passes all our tests, we can get this merged.
Eventually, I still would like us to remove our own logging.Logger
class in favor of using Python's builtin logger only where appropriate (for logging; not for error handling or taking user input) and using more appropriate tools for managing other things. But for now, let's get this in and tackle the rest of the problem later.
Thanks, I've added a comment clarifying the meaning |
Description
#428 – This PR implements the swell
logger
as an extension of thelogging
library. This means that Swell loggers are now handled in a similar way to the base library.The Logger class in the
logging
library is invoked through thegetLogger
method, rather than directly. This method goes through a manager class, which handles initialized logger objects. This PR introduces theget_logger
method, which overrides the baselogging.Manager
object so it uses the swell Logger. Functions fromLogger
such asinfo()
override the base functions, so the behavior doesn't change. InvokingLogger
directly will still work, but if accepted, logger instances should ideally be invoked usingget_logger
in the future.