本文整理匯總了Python中rainbow_logging_handler.RainbowLoggingHandler._column_color['%(message)s'][SUCCESS]方法的典型用法代碼示例。如果您正苦於以下問題:Python RainbowLoggingHandler._column_color['%(message)s'][SUCCESS]方法的具體用法?Python RainbowLoggingHandler._column_color['%(message)s'][SUCCESS]怎麽用?Python RainbowLoggingHandler._column_color['%(message)s'][SUCCESS]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rainbow_logging_handler.RainbowLoggingHandler
的用法示例。
在下文中一共展示了RainbowLoggingHandler._column_color['%(message)s'][SUCCESS]方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: verbose
# 需要導入模塊: from rainbow_logging_handler import RainbowLoggingHandler [as 別名]
# 或者: from rainbow_logging_handler.RainbowLoggingHandler import _column_color['%(message)s'][SUCCESS] [as 別名]
import logging, sys
from rainbow_logging_handler import RainbowLoggingHandler
logging.VERBOSE = VERBOSE = 5
logging.SUCCESS = SUCCESS = logging.INFO + 5
logging.addLevelName(VERBOSE, "VERBOSE")
logging.addLevelName(SUCCESS, "SUCCESS")
def verbose(self, message, *args, **kws):
# Yes, logger takes its '*args' as 'args'.
if self.isEnabledFor(VERBOSE):
self._log(VERBOSE, message, args, **kws)
logging.Logger.verbose = verbose
logging.Logger.v = verbose
def success(self, message, *args, **kws):
# Yes, logger takes its '*args' as 'args'.
if self.isEnabledFor(SUCCESS):
self._log(SUCCESS, message, args, **kws)
logging.Logger.success = success
logging.Logger.ok = success
logger = logging.getLogger('dj')
formatter = logging.Formatter("[%(asctime)s] %(name)s:\t%(message)s") # same as default
# setup `RainbowLoggingHandler`
handler = RainbowLoggingHandler(sys.stderr, color_funcName=('black', 'yellow', True))
handler.setFormatter(formatter)
handler._column_color['%(message)s'][VERBOSE] = ('magenta', None, False)
handler._column_color['%(message)s'][SUCCESS] = ('green', None, False)
logger.addHandler(handler)
logger.setLevel(VERBOSE)