Skip to content

Instantly share code, notes, and snippets.

@Ogaday
Created December 15, 2023 13:02
Show Gist options
  • Save Ogaday/eb481b848b0c1c1d4317336bcfb99027 to your computer and use it in GitHub Desktop.
Save Ogaday/eb481b848b0c1c1d4317336bcfb99027 to your computer and use it in GitHub Desktop.
Class loggers
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