コード例 #1
0
 def __init__(self,
              host='localhost',
              port=24224,
              tag='',
              timeout=1,
              capacity=None):
     logging.Handler.__init__(self)
     self.tag = tag
     self.fluent = FluentSender(host, port, tag, timeout, capacity)
コード例 #2
0
ファイル: logging.py プロジェクト: yosisa/pyfluent
class SafeFluentHandler(logging.Handler):
    def __init__(self, host='localhost', port=24224, tag='',
                 timeout=1, capacity=None):
        logging.Handler.__init__(self)
        self.tag = tag
        self.fluent = FluentSender(host, port, tag, timeout, capacity)

    def emit(self, record):
        try:
            data = self.format(record)
            tag = ('%s.%s' % (self.tag, record.levelname.lower())).lstrip('.')
            self.fluent.send(data, tag, record.created)
        except (KeyboardInterrupt, SystemExit):
            raise
        except:
            self.handleError(record)

    def close(self):
        self.fluent.close()
        logging.Handler.close(self)
コード例 #3
0
class SafeFluentHandler(logging.Handler):
    def __init__(self,
                 host='localhost',
                 port=24224,
                 tag='',
                 timeout=1,
                 capacity=None):
        logging.Handler.__init__(self)
        self.tag = tag
        self.fluent = FluentSender(host, port, tag, timeout, capacity)

    def emit(self, record):
        try:
            data = self.format(record)
            tag = ('%s.%s' % (self.tag, record.levelname.lower())).lstrip('.')
            self.fluent.send(data, tag, record.created)
        except (KeyboardInterrupt, SystemExit):
            raise
        except:
            self.handleError(record)

    def close(self):
        self.fluent.close()
        logging.Handler.close(self)
コード例 #4
0
ファイル: logging.py プロジェクト: yosisa/pyfluent
 def __init__(self, host='localhost', port=24224, tag='',
              timeout=1, capacity=None):
     logging.Handler.__init__(self)
     self.tag = tag
     self.fluent = FluentSender(host, port, tag, timeout, capacity)