예제 #1
0
    def __init__(self, config, level=None):
        BufferingHandler.__init__(self, 1000)
        self.config = config
        self.old_handlers = []
        self.old_level = None

        # set my formatter
        log_format = datefmt = None
        if config.logging_format:
            log_format = config.logging_format
        else:
            log_format = '%(levelname)s:%(name)s:%(message)s'
        if config.logging_datefmt:
            datefmt = config.logging_datefmt
        formatter = logging.Formatter(log_format, datefmt)
        self.setFormatter(formatter)

        # 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))
예제 #2
0
 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
0
    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
0
 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)
예제 #5
0
    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))
예제 #6
0
    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))
예제 #7
0
    def __init__(self,
                 indexed_keys={'level', 'short_message'},
                 debugging_fields=True,
                 extra_fields=True,
                 localname=None,
                 measurement=None,
                 level_names=False,
                 capacity=64,
                 flush_interval=5,
                 backpop=True,
                 **client_kwargs):
        self.debugging_fields = debugging_fields
        self.extra_fields = extra_fields
        self.localname = localname
        self.measurement = measurement
        self.level_names = level_names
        self.indexed_keys = indexed_keys
        self.client = InfluxDBClient(**client_kwargs)
        self.flush_interval = flush_interval
        self._thread = None if flush_interval is None else threading.Thread(
            target=self._flush_thread,
            name="BufferingInfluxHandler",
            daemon=True)

        InfluxHandler.__init__(self,
                               indexed_keys=None,
                               debugging_fields=debugging_fields,
                               extra_fields=extra_fields,
                               localname=localname,
                               measurement=measurement,
                               level_names=level_names,
                               backpop=backpop,
                               **client_kwargs)
        BufferingHandler.__init__(self, capacity)
        self._thread.start()
예제 #8
0
    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)
예제 #9
0
    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
예제 #10
0
파일: utils.py 프로젝트: anabcm/compranet
 def __init__(self, user, password,
              email_to, email_subject, email_from=None,
              capacity=10000, host='smtp.gmail.com', port=465):
     BufferingHandler.__init__(self, capacity)
     self.host = host
     self.port = port
     self.user = user
     self.password = password
     self.email_from = user if email_from is None else email_from
     self.email_to = email_to
     self.email_subject = email_subject
예제 #11
0
 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
예제 #12
0
    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
예제 #13
0
파일: logger.py 프로젝트: Gnewbee/suplemon
    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
예제 #14
0
 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
예제 #15
0
    def __init__(self, capacity, wait_on_flush=False,
                 ch_conn='http://localhost:8123', ch_table=None,
                 logging_build_in_columns_to_ch=None):
        """
        Initialize the handler with the buffer size, the level at which
        flushing should occur and an optional target.

        Note that without a target being set either here or via setTarget(),
        a MemoryHandler is no use to anyone!
        """
        BufferingHandler.__init__(self, capacity)
        self.wait_on_flush = wait_on_flush
        if not ch_table:
            raise ValueError('ch_table must be provided')
        self.ch_table = ch_table
        self.ch_conn = ch_conn
        self.build_in_keys_to_ch = logging_build_in_columns_to_ch or ['message', 'levelname', 'filename',
                                                                      'module', 'lineno,', 'exc_info',
                                                                      'created', 'msecs',
                                                                      'relativeCreated', 'asctime']
        self.build_in_log_keys = ['name', 'msg', 'args', 'levelname', 'levelno', 'pathname', 'filename', 'module',
                                  'exc_info', 'exc_text', 'stack_info', 'lineno', 'funcName', 'created', 'msecs',
                                  'relativeCreated', 'thread', 'threadName', 'processName', 'process']
예제 #16
0
 def __init__(self, widget):
     BufferingHandler.__init__(self, 100)
     self.widget = widget
예제 #17
0
 def __init__(self):
     BufferingHandler.__init__(self, maxsize)
예제 #18
0
파일: logger.py 프로젝트: D3f0/prymatex
 def __init__(self, widget):
     BufferingHandler.__init__(self, 100)
     self.widget = widget
예제 #19
0
 def __init__(self, bucket, prefix=''):
     BufferingHandler.__init__(self, 0)
     self.bucket = bucket
     self.prefix = prefix
예제 #20
0
 def __init__(self):
     BufferingHandler.__init__(self, 0)
예제 #21
0
 def __init__(self):
     # Capacity is zero, as we won't rely on
     # it when deciding when to flush data
     BufferingHandler.__init__(self, 0)
예제 #22
0
 def __init__(self):
     BufferingHandler.__init__(self, maxsize)
예제 #23
0
파일: testcase.py 프로젝트: DarkFenX/eos
 def __init__(self):
     # Capacity is zero, as we won't rely on it when deciding when to flush
     # data
     BufferingHandler.__init__(self, 0)
예제 #24
0
파일: ut.py 프로젝트: leroux/cot
 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
 def __init__(self, capacity, queue):
     """
     Initialize the handler with buffer size and queue
     """
     BufferingHandler.__init__(self, capacity)
     self.queue = queue
예제 #26
0
 def __init__(self, master_logger: Optional[logging.Logger] = None):
     BufferingHandler.__init__(self, capacity=1000000)
     self._master_logger = master_logger
예제 #27
0
 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
예제 #28
0
 def __init__(self, capacity, logformat, logdatefmt, filters):
     BufferingHandler.__init__(self, capacity)
     fmt = logging.Formatter(logformat, logdatefmt)
     self.setFormatter(fmt)
     self.filterset = FilterSet(filters)
 def __init__(self, capacity=1000000, flushLevel=logging.ERROR, target=None):
     BufferingHandler.__init__(self, capacity)
     self.target = target
     logger = logging.getLogger('AuditTrail')
     logger.info('AuditTrail.TransactionEndHandler> Registering with TM')
     transaction.manager.registerGlobalSynch(self)
예제 #30
0
 def __init__(self, bucket, prefix=''):
     BufferingHandler.__init__(self, 0)
     self.bucket = bucket
     self.prefix = prefix
예제 #31
0
 def __init__(self):
     BufferingHandler.__init__(self, 0)
예제 #32
0
 def __init__(self):
     BufferingHandler.__init__(self, sys.maxint)
예제 #33
0
 def __init__(self, capacity, logformat, logdatefmt, filters):
     BufferingHandler.__init__(self, capacity)
     fmt = logging.Formatter(logformat, logdatefmt)
     self.setFormatter(fmt)
     self.filterset = FilterSet(filters)
예제 #34
0
 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
예제 #35
0
 def __init__(self):
     BufferingHandler.__init__(self, sys.maxint)
예제 #36
0
 def __init__(self, capacity, queue):
     """
     Initialize the handler with buffer size and queue
     """
     BufferingHandler.__init__(self, capacity)
     self.queue = queue
예제 #37
0
파일: handlers.py 프로젝트: tubav/teagle
	def __init__(self, capacity = None):
		_BufferingHandler.__init__(self, capacity = capacity)
 def __init__(self, capacity=None):
     _BufferingHandler.__init__(self, capacity=capacity)
예제 #39
0
 def __init__(self, messages):
     BufferingHandler.__init__(self, 0)
     self.messages = messages