本文整理汇总了Python中logging.handlers.BufferingHandler.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python BufferingHandler.__init__方法的具体用法?Python BufferingHandler.__init__怎么用?Python BufferingHandler.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类logging.handlers.BufferingHandler
的用法示例。
在下文中一共展示了BufferingHandler.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
def __init__(self, config, level=None):
BufferingHandler.__init__(self, 1000)
self.config = config
self.old_handlers = []
# set my formatter
fmt = datefmt = None
if config.logging_format:
fmt = config.logging_format
else:
fmt = "%(levelname)s:%(name)s:%(message)s"
if config.logging_datefmt:
datefmt = config.logging_datefmt
fmt = logging.Formatter(fmt, datefmt)
self.setFormatter(fmt)
# figure the level we're logging at
if level is not None:
self.level = level
elif config.logging_level:
self.level = getattr(logging, config.logging_level.upper(), None)
if self.level is None:
raise ConfigError('Invalid log level: "%s"' % config.logging_level)
else:
self.level = logging.NOTSET
# construct my filter
if config.logging_filter:
self.addFilter(RecordFilter(config.logging_filter))
示例2: __init__
# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
def __init__(self):
# BufferingHandler takes a "capacity" argument
# so as to know when to flush. As we're overriding
# shouldFlush anyway, we can set a capacity of zero.
# You can call flush() manually to clear out the
# buffer.
BufferingHandler.__init__(self, 0)
示例3: __init__
# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
def __init__(self, config, level=None):
BufferingHandler.__init__(self, 1000)
self.config = config
self.old_handlers = []
self.old_level = None
# set my formatter
fmt = datefmt = None
if config.logging_format:
fmt = config.logging_format
else:
fmt = '%(levelname)s:%(name)s:%(message)s'
if config.logging_datefmt:
datefmt = config.logging_datefmt
fmt = logging.Formatter(fmt, datefmt)
self.setFormatter(fmt)
# figure the level we're logging at
if level is not None:
self.level = level
elif config.logging_level:
self.level = config.logging_level
else:
self.level = logging.NOTSET
# construct my filter
if config.logging_filter:
self.addFilter(RecordFilter(config.logging_filter))
示例4: __init__
# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
def __init__(self, target, thresholdLevel, retainLevel):
BufferingHandler.__init__(self, capacity=0)
self.target = target
self.thresholdLevel = thresholdLevel
if retainLevel is None:
retainLevel = thresholdLevel
self.setLevel(retainLevel)
示例5: __init__
# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
def __init__(self, testcase):
"""Create a logging handler for the given test case.
Args:
testcase (unittest.TestCase): Owner of this logging handler.
"""
BufferingHandler.__init__(self, capacity=0)
self.setLevel(logging.DEBUG)
self.testcase = testcase
示例6: __init__
# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
def __init__(self, level, capacity, host, port,
fromaddr, toaddrs, user=None, passwd=None,
subject='logs', encoding='utf-8'):
BufferingHandler.__init__(self, capacity)
self.setLevel(level)
self.host = host
self.port = port
self.fromaddr = fromaddr
self.toaddrs = toaddrs if isinstance(toaddrs, (list, tuple)) else [toaddrs]
self.user = user
self.passwd = passwd
self.subject = Header(subject)
self.encoding = encoding
示例7: __init__
# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
def __init__(self, capacity, fd_target):
"""
:param int capacity: Amount of records to store in memory
https://github.com/python/cpython/blob/3.3/Lib/logging/handlers.py#L1161-L1176
:param object fd_target: File descriptor to write output to (e.g. `sys.stdout`)
"""
# Call our BufferingHandler init
if issubclass(BufferingTargetHandler, object):
super(BufferingTargetHandler, self).__init__(capacity)
else:
BufferingHandler.__init__(self, capacity)
# Save target for later
self._fd_target = fd_target
示例8: __init__
# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
def __init__(self):
BufferingHandler.__init__(self, sys.maxint)
示例9: __init__
# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
def __init__(self, capacity, logformat, logdatefmt, filters):
BufferingHandler.__init__(self, capacity)
fmt = logging.Formatter(logformat, logdatefmt)
self.setFormatter(fmt)
self.filterset = FilterSet(filters)
示例10: __init__
# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
def __init__(self, capacity = None):
_BufferingHandler.__init__(self, capacity = capacity)
示例11: __init__
# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
def __init__(self, capacity):
# BufferingHandler is old styled class, so we can't use super here.
BufferingHandler.__init__(self, capacity)
self._buffer = []
self._capacity = capacity
self._position = 0
示例12: __init__
# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
def __init__(self, messages):
BufferingHandler.__init__(self, 0)
self.messages = messages
示例13: __init__
# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
def __init__(self):
BufferingHandler.__init__(self, maxsize)
示例14: __init__
# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
def __init__(self, capacity, queue):
"""
Initialize the handler with buffer size and queue
"""
BufferingHandler.__init__(self, capacity)
self.queue = queue
示例15: __init__
# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
def __init__(self, testcase):
"""Create a logging handler for the given test case."""
BufferingHandler.__init__(self, capacity=0)
self.setLevel(logging.DEBUG)
self.testcase = testcase