Add snake_case alias get_logger, getLogger.

This commit is contained in:
voussoir 2021-10-24 23:34:08 -07:00
parent ea08e2399e
commit 7d9489b5ae
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -24,9 +24,9 @@ root.setLevel(NOTSET)
LOUD = 1 LOUD = 1
SILENT = 99999999999 SILENT = 99999999999
def getLogger(name=None, main_fallback=None): def get_logger(name=None, main_fallback=None):
''' '''
Normally it is best practice to use getLogger(__name__), but when running Normally it is best practice to use get_logger(__name__), but when running
a script directly you'll see "__main__" in the output, which I think is a script directly you'll see "__main__" in the output, which I think is
ugly and unexpected for anyone who doesn't know what's going on behind ugly and unexpected for anyone who doesn't know what's going on behind
the scenes. But hardcoding your logger name is not good either. the scenes. But hardcoding your logger name is not good either.
@ -38,6 +38,8 @@ def getLogger(name=None, main_fallback=None):
add_loud(log) add_loud(log)
return log return log
getLogger = get_logger
def add_loud(log): def add_loud(log):
''' '''
Add the `loud` method to the given logger. Add the `loud` method to the given logger.