def printDebug(message, priority=logging.WARN):
""" Logs message given the priority specified
arguments:
message - the string message to be logged
priority - the integer priority of the message; uses the priority levels in the logging module
returns:
nothing
"""
# this function (and hence the library) originally did not use the logging module from the standard library
global sparki_logger
# for compatibility, we will recognize the "old" priority levels, but new code should be written to conform to the
# priority levels in the logging module
if priority == DEBUG_DEBUG or priority == logging.DEBUG:
sparki_logger.debug(message)
elif priority == DEBUG_INFO or priority == logging.INFO:
sparki_logger.info(message)
elif priority == DEBUG_WARN or priority == logging.WARN:
sparki_logger.warn(message)
elif priority == DEBUG_ERROR or priority == logging.ERROR:
sparki_logger.error(message)
else:
sparki_logger.critical(message)
评论列表
文章目录