当前位置: 首页>>代码示例>>Python>>正文


Python BufferingHandler.__init__方法代码示例

本文整理汇总了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))
开发者ID:KevinMarkVI,项目名称:behave-parallel,代码行数:33,代码来源:log_capture.py

示例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)
开发者ID:fungusakafungus,项目名称:superlance,代码行数:9,代码来源:uptimemon_test.py

示例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))
开发者ID:vrutkovs,项目名称:beehive,代码行数:30,代码来源:log_capture.py

示例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)
开发者ID:jon-turney,项目名称:calm,代码行数:10,代码来源:abeyance_handler.py

示例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
开发者ID:harrisonfeng,项目名称:cot,代码行数:11,代码来源:cot_testcase.py

示例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
开发者ID:Igelko,项目名称:pyroutines,代码行数:15,代码来源:smtp_logger.py

示例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
开发者ID:Gnewbee,项目名称:suplemon,代码行数:16,代码来源:logger.py

示例8: __init__

# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
 def __init__(self):
     BufferingHandler.__init__(self, sys.maxint)
开发者ID:grodniewicz,项目名称:oship,代码行数:4,代码来源:loghandler.py

示例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)
开发者ID:AlexArgus,项目名称:affiliates-lib,代码行数:7,代码来源:logcapture.py

示例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)
开发者ID:tubav,项目名称:teagle,代码行数:4,代码来源:handlers.py

示例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
开发者ID:JoelMarcey,项目名称:nuclide,代码行数:8,代码来源:nuclide_server_logger.py

示例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
开发者ID:necaris,项目名称:python3-openid,代码行数:5,代码来源:support.py

示例13: __init__

# 需要导入模块: from logging.handlers import BufferingHandler [as 别名]
# 或者: from logging.handlers.BufferingHandler import __init__ [as 别名]
 def __init__(self):
     BufferingHandler.__init__(self, maxsize)
开发者ID:steffann,项目名称:ZConfig,代码行数:4,代码来源:loghandler.py

示例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
开发者ID:joekickass,项目名称:python-kinesis-logger,代码行数:8,代码来源:kinesishandler.py

示例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
开发者ID:leroux,项目名称:cot,代码行数:7,代码来源:ut.py


注:本文中的logging.handlers.BufferingHandler.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。