本文整理汇总了Python中logging.handlers.MemoryHandler.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python MemoryHandler.__init__方法的具体用法?Python MemoryHandler.__init__怎么用?Python MemoryHandler.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logging.handlers.MemoryHandler
的用法示例。
在下文中一共展示了MemoryHandler.__init__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from logging.handlers import MemoryHandler [as 别名]
# 或者: from logging.handlers.MemoryHandler import __init__ [as 别名]
def __init__(self, when='h', interval=1, backupCount=0):
"""
Constructor for logging formatter.
"""
# Formatting string
format_str = '%(asctime)s - %(levelname)s'
if TvbProfile.current.cluster.IN_OPERATION_EXECUTION_PROCESS:
log_file = self.CLUSTER_NODES_LOG_FILE
if TvbProfile.current.cluster.IS_RUNNING_ON_CLUSTER_NODE:
node_name = TvbProfile.current.cluster.CLUSTER_NODE_NAME
if node_name is not None:
format_str += ' [node:' + str(node_name) + '] '
else:
format_str += ' [proc:' + str(os.getpid()) + '] '
else:
log_file = self.WEB_LOG_FILE
format_str += ' - %(name)s - %(message)s'
rotating_file_handler = SimpleTimedRotatingFileHandler(log_file, when, interval, backupCount)
rotating_file_handler.setFormatter(logging.Formatter(format_str))
MemoryHandler.__init__(self, capacity=self.BUFFER_CAPACITY, target=rotating_file_handler)
示例2: __init__
# 需要导入模块: from logging.handlers import MemoryHandler [as 别名]
# 或者: from logging.handlers.MemoryHandler import __init__ [as 别名]
def __init__(self, capacity, mail_subject):
MemoryHandler.__init__(self,
capacity,
flushLevel=logging.ERROR,
target=None)
self.mail_subject = mail_subject
self.flushed_buffers = []
示例3: __init__
# 需要导入模块: from logging.handlers import MemoryHandler [as 别名]
# 或者: from logging.handlers.MemoryHandler import __init__ [as 别名]
def __init__(self, target):
MemoryHandler.__init__(self, 100000, target=target)
self.setLevel(logging.ERROR)
示例4: __init__
# 需要导入模块: from logging.handlers import MemoryHandler [as 别名]
# 或者: from logging.handlers.MemoryHandler import __init__ [as 别名]
def __init__(self, capacity, flushLevel=logging.ERROR, target=None):
MemoryHandler.__init__(self, capacity, flushLevel=flushLevel, target=target)
示例5: __init__
# 需要导入模块: from logging.handlers import MemoryHandler [as 别名]
# 或者: from logging.handlers.MemoryHandler import __init__ [as 别名]
def __init__(self, capacity=1000000, flushLevel=logging.CRITICAL):
nh = logging.NullHandler()
MemoryHandler.__init__(self, capacity,
flushLevel=flushLevel, target=nh)