Review Board Ticket #4903: Diffviewer module should use named logging

4 views
Skip to first unread message

Mike Conley

unread,
Jan 21, 2021, 6:27:56 PM1/21/21
to Mike Conley, reviewboa...@googlegroups.com
To reply, visit https://hellosplat.com/s/beanbag/tickets/4903/

New ticket #4903 by mconley

For Beanbag, Inc. Review Board

Diffviewer module should use named logging

There are numerous instances of files under reviewboard/reviewboard/diffviewer/ using this pattern:

import logging

# ...
logging.warning("Some warning message")
logging.error("Some error message")
logging.exception("Handled some exception")
# etc

etc. While this is useful, these logging messages can be made more useful if they are "named", meaning that the logging mechanism automatically includes information about the module where the logging message came from which can be handy when diagnosing problems from logs.

Named logging looks like this:

import logging

logger = logging.getLogger(__name__)
# ^-- make sure to do this at the top of the script execution scope so that `logger` is available throughout the script.

#...

logger.warning("This is a warning to a named logger")
logger.error("This is a error to a named logger")
logger.exception("This is a exception to a named logger")
# etc

The directory in question uses some named logging. The goal here is to replace the other usages to use named logging. The log messages themselves shouldn't change, and there's no need to add new log messages - just convert the ones that exist in this module directory to named logging.

New Priority:Medium Type:Defect

Mike Conley

unread,
Jan 21, 2021, 6:28:05 PM1/21/21
to Mike Conley, reviewboa...@googlegroups.com

New update by mconley

For Beanbag, Inc. Review Board Ticket #4903

Tags:
+ EasyFix
Reply all
Reply to author
Forward
0 new messages