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


Python handlers.DatagramHandler类代码示例

本文整理汇总了Python中logging.handlers.DatagramHandler的典型用法代码示例。如果您正苦于以下问题:Python DatagramHandler类的具体用法?Python DatagramHandler怎么用?Python DatagramHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DatagramHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, host, port=12201, chunk_size=WAN_CHUNK,
         debugging_fields=True, extra_fields=True, fqdn=False):
     self.debugging_fields = debugging_fields
     self.extra_fields = extra_fields
     self.chunk_size = chunk_size
     self.fqdn = fqdn
     DatagramHandler.__init__(self, host, port)
开发者ID:saluker,项目名称:graypy,代码行数:7,代码来源:handler.py

示例2: send

 def send(self, s):
     if len(s) <= self.chunk_size:
         DatagramHandler.send(self, s)
     else:
         chunks = gelf.split(s, self.chunk_size)
         for chunk in chunks:
             DatagramHandler.send(self, chunk)
开发者ID:tinedel,项目名称:pygelf,代码行数:7,代码来源:handlers.py

示例3: __init__

    def __init__(self, host, port=5959, message_type='logstash', fqdn=False, version=0, tags=None):
        DatagramHandler.__init__(self, host, port)

        tags = tags or []

        if version == 1:
            self.formatter = formatter.LogstashFormatterVersion1(message_type, tags, fqdn)
        else:
            self.formatter = formatter.LogstashFormatterVersion0(message_type, tags, fqdn)
开发者ID:shaunduncan,项目名称:python-logstash,代码行数:9,代码来源:handler.py

示例4: __init__

 def __init__(self, host, port=12201, chunk_size=WAN_CHUNK,
         debugging_fields=True, extra_fields=True, fqdn=False, 
         localname=None, facility=None):
     self.debugging_fields = debugging_fields
     self.extra_fields = extra_fields
     self.chunk_size = chunk_size
     self.fqdn = fqdn
     self.localname = localname
     self.facility = facility
     DatagramHandler.__init__(self, host, port)
开发者ID:diezguerra,项目名称:graypy,代码行数:10,代码来源:handler.py

示例5: __init__

 def __init__(self, host, port=9700, max_packet_size=64*1024,
              debugging_fields=False, extra_fields=True, fqdn=False,
              localname=None, index="logstash-%Y.%m.%d", type="logs"):
     self.debugging_fields = debugging_fields
     self.extra_fields = extra_fields
     self.max_packet_size = max_packet_size
     self.fqdn = fqdn
     self.localname = localname
     self.index = index
     self.type = type
     DatagramHandler.__init__(self, host, port)
开发者ID:thangnvaltplus,项目名称:elpylog,代码行数:11,代码来源:handler.py

示例6: __init__

 def __init__(self, host, port, chunk_size=WAN_CHUNK):
     self.chunk_size = chunk_size
     # skip_list is used to filter additional fields in a log message.
     # It contains all attributes listed in
     # http://docs.python.org/library/logging.html#logrecord-attributes
     # plus exc_text, which is only found in the logging module source,
     # and id, which is prohibited by the GELF format.
     self.skip_list = set(['args', 'asctime', 'created', 'exc_info',  'exc_text',
         'filename', 'funcName', 'id', 'levelname', 'levelno', 'lineno',
         'module', 'msecs', 'msecs', 'message', 'msg', 'name', 'pathname',
         'process', 'processName', 'relativeCreated', 'thread', 'threadName'])
     DatagramHandler.__init__(self, host, port)
开发者ID:ress,项目名称:graypy,代码行数:12,代码来源:handler.py

示例7: __init__

    def __init__(self, host, port, compress=True, chunk_size=1300, **kwargs):
        """
        Logging handler that transforms each record into GELF (graylog extended log format) and sends it over UDP.
        If message length exceeds chunk_size, the message splits into multiple chunks.
        The number of chunks must be less than 128.

        :param host: GELF UDP input host
        :param port: GELF UDP input port
        :param compress: compress message before send it to the server or not
        :param chunk_size: length of a chunk, should be less than the MTU (maximum transmission unit)
        """

        DatagramHandler.__init__(self, host, port)
        BaseHandler.__init__(self, **kwargs)

        self.compress = compress
        self.chunk_size = chunk_size
开发者ID:tinedel,项目名称:pygelf,代码行数:17,代码来源:handlers.py

示例8: __init__

    def __init__(self, host=None, port=None, source=None, role_list=None):
        DatagramHandler.__init__(self,
                                 host or constants.HOST,
                                 port or constants.PORT)

        # source_ip
        cls = self.__class__
        if not cls.source_ip:
            try:
                # 一步步来,这样第二步报错时,起码也把名字设置上了
                cls.source_ip = socket.gethostname()
                # 有些电脑上会很慢,还是不用了,就用名字算了
                # cls.source_ip = socket.gethostbyname(cls.source_ip)
            except:
                pass

            cls.source_ip = cls.source_ip or 'none'

        self.source = source
        self.role_list = role_list
开发者ID:dantezhu,项目名称:flylog,代码行数:20,代码来源:log_handler.py

示例9: log_init

def log_init(log_path):
    _logger = logging.getLogger(logger_name)

    file_name = str(log_path).split('/')[-1].split('.')[0]
    datefmt = '%Y-%m-%d %I:%M:%S %p'
    fmt = '%(asctime)s-[%(levelname)s]-[' + file_name + ']: %(message)s'

    _logger.setLevel(logging.DEBUG)
    fh = logging.FileHandler(log_path)
    fh.setLevel(logging.INFO)
    fh.setFormatter(Formatter(fmt, datefmt))
    _logger.addHandler(fh)

    ch = logging.StreamHandler(sys.stdout)
    ch.setLevel(logging.DEBUG)
    ch.setFormatter(MyFormatter(fmt, datefmt))
    _logger.addHandler(ch)

    uh = DatagramHandler(const.const.TLOG_ADDR[0], const.const.TLOG_ADDR[1])
    uh.setLevel(logging.CRITICAL)
    uh.setFormatter('%(message)s')
开发者ID:isphinx,项目名称:traversing,代码行数:21,代码来源:logobj.py

示例10: __init__

 def __init__(self, host, port=5959, message_type='logstash', fqdn=False):
     self.message_type = message_type
     self.fqdn = fqdn
     DatagramHandler.__init__(self, host, port)
开发者ID:moniker-dns,项目名称:python-logstash,代码行数:4,代码来源:handler.py

示例11: makeSocket

 def makeSocket(self):
     return DatagramHandler.makeSocket(self)
开发者ID:dantezhu,项目名称:flylog,代码行数:2,代码来源:log_handler.py

示例12: __init__

 def __init__(self, host, port, chunk_size=WAN_CHUNK, debugging_fields=True):
     self.debugging_fields = debugging_fields
     self.chunk_size = chunk_size
     DatagramHandler.__init__(self, host, port)
开发者ID:katraev,项目名称:graypy,代码行数:4,代码来源:handler.py

示例13: __init__

 def __init__(self, host, port=5959, message_type="logstash", fqdn=False, version=0):
     DatagramHandler.__init__(self, host, port)
     if version == 1:
         self.formatter = formatter.LogstashFormatterVersion1(message_type, [], fqdn)
     else:
         self.formatter = formatter.LogstashFormatterVersion0(message_type, [], fqdn)
开发者ID:nsmfoo,项目名称:python-logstash,代码行数:6,代码来源:handler.py

示例14: __init__

 def __init__(self, host, port=5959, message_type="logstash", fqdn=False, version=0):
     self.message_type = message_type
     self.fqdn = fqdn
     self.version = version
     DatagramHandler.__init__(self, host, port)
开发者ID:radeksimko,项目名称:python-logstash,代码行数:5,代码来源:handler.py

示例15: __init__

 def __init__(self, host, port, chunk_size=WAN_CHUNK):
     self.chunk_size = chunk_size
     DatagramHandler.__init__(self, host, port)
开发者ID:colinn,项目名称:graypy,代码行数:3,代码来源:handler.py


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