Add snake_case alias get_logger, getLogger.

master
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
1 changed files with 4 additions and 2 deletions

View File

@ -24,9 +24,9 @@ root.setLevel(NOTSET)
LOUD = 1
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
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.
@ -38,6 +38,8 @@ def getLogger(name=None, main_fallback=None):
add_loud(log)
return log
getLogger = get_logger
def add_loud(log):
'''
Add the `loud` method to the given logger.