Created
December 15, 2023 13:02
-
-
Save Ogaday/eb481b848b0c1c1d4317336bcfb99027 to your computer and use it in GitHub Desktop.
Class loggers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
class Foo: | |
def __init__(self): | |
""" | |
>>> f = Foo() | |
>>> f.logger() | |
<Logger class_logger_example.Foo (WARNING)> | |
""" | |
self.logger = logging.getLogger(__name__).getChild(type(self).__name__) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment