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


Python Handler.push方法代码示例

本文整理汇总了Python中handler.Handler.push方法的典型用法代码示例。如果您正苦于以下问题:Python Handler.push方法的具体用法?Python Handler.push怎么用?Python Handler.push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在handler.Handler的用法示例。


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

示例1: read

# 需要导入模块: from handler import Handler [as 别名]
# 或者: from handler.Handler import push [as 别名]
 def read(self):
     line = self.file.readline()
     while line:
         self.count += 1
         Handler.push(self, {'type': 'line',
                             'raw': line.strip(),
                             'source': self.name })
         line = self.file.readline()
     reactor.callLater(1, self.read)
开发者ID:odanielson,项目名称:carmanor,代码行数:11,代码来源:filereader.py

示例2: push

# 需要导入模块: from handler import Handler [as 别名]
# 或者: from handler.Handler import push [as 别名]
    def push(self, data):
        if (data.has_key('timestamp')):
            print("%s - %s : %s" % (data['timestamp'],
                                    data['source'],
                                    data['raw']))
        else:
            print("unknown - %s : %s" % (data['source'],
                                         data['raw']))

        Handler.push(self, data)
开发者ID:odanielson,项目名称:carmanor,代码行数:12,代码来源:stdoutprinter.py

示例3: push

# 需要导入模块: from handler import Handler [as 别名]
# 或者: from handler.Handler import push [as 别名]
    def push(self, data):

        match = data['raw'].find("ERROR")>=0
        if not self.match and match:
            self.info("Detected ERROR")
            data['type'] = 'event'
            data['raw'] = "@type:\"line\" AND @timestamp:[\"%s\" *] - %s" % (
                data['timestamp'], data['raw'])

            Handler.push(self, data)

        self.match = match
开发者ID:odanielson,项目名称:carmanor,代码行数:14,代码来源:erroreventdetector.py

示例4: push

# 需要导入模块: from handler import Handler [as 别名]
# 或者: from handler.Handler import push [as 别名]
    def push(self, data):
        self.debug("Parsing time in data %s" % (data))
        try:
            parser = self.parsers.get(data['source'])
            if not parser:
                parser = self.parsers[data['source']] = self._autodetect(
                    data['raw'])

            stamp = parser(data['raw'])
            stamp = self._format_time(self._adjust_time(stamp))
            data['timestamp'] = stamp
        except Exception as e:
            self.warning("Failed to parse time in %s" % (data['raw']))

        Handler.push(self, data)
开发者ID:odanielson,项目名称:carmanor,代码行数:17,代码来源:autotimeparser.py

示例5: Receiver

# 需要导入模块: from handler import Handler [as 别名]
# 或者: from handler.Handler import push [as 别名]
    receiver = Receiver()
    transmitter = Transmitter()
    receiver.connect()

    td1 = threading.Thread(target=handler.run)
    td2 = threading.Thread(target=receiver.run)
    td3 = threading.Thread(target=transmitter.run)
    td1.start()
    td2.start()
    td3.start()

    # main loop
    while True:
        if handler.is_runing() and receiver.is_runing() and transmitter.is_runing():
            msg = receiver.fetch()
            while msg != None:
                handler.push(msg)
                msg = receiver.fetch()
            msg = handler.fetch_to_send()
            while msg != None:
                transmitter.push(msg)
                msg = handler.fetch_to_send()
        else:
            break

    handler.stop()
    receiver.stop()
    transmitter.stop()
    td1.join()
    td2.join()
    td3.join()
开发者ID:fangbei,项目名称:email_robot,代码行数:33,代码来源:main.py

示例6: push

# 需要导入模块: from handler import Handler [as 别名]
# 或者: from handler.Handler import push [as 别名]
    def push(self, data):
        self.debug("Pushing data %s to elastic search" % (data))
        event = ElasticEvent(data)
        self.es.index("carmanor", "line", event.dict())

        Handler.push(self, data)
开发者ID:odanielson,项目名称:carmanor,代码行数:8,代码来源:elasticpush.py


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