當前位置: 首頁>>代碼示例>>Python>>正文


Python Handler.__init__方法代碼示例

本文整理匯總了Python中logging.Handler.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python Handler.__init__方法的具體用法?Python Handler.__init__怎麽用?Python Handler.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在logging.Handler的用法示例。


在下文中一共展示了Handler.__init__方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from logging import Handler [as 別名]
# 或者: from logging.Handler import __init__ [as 別名]
def __init__(self, debug=False, version='1.1', include_extra_fields=False, compress=False,
                 static_fields=None, json_default=gelf.object_to_json, **kwargs):
        """
        Logging handler that transforms each record into GELF (graylog extended log format) and sends it over TCP.

        :param debug: include debug fields, e.g. line number, or not
        :param include_extra_fields: include non-default fields from record to message, or not
        :param json_default: function that is called for objects that cannot be serialized to JSON natively by python
        :param kwargs: additional fields that will be included in the log message, e.g. application name.
                       Each additional field should start with underscore, e.g. _app_name
        """

        self.debug = debug
        self.version = version
        self.additional_fields = static_fields if static_fields else kwargs
        self.include_extra_fields = include_extra_fields
        self.additional_fields.pop('_id', None)
        self.domain = socket.gethostname()
        self.compress = compress
        self.json_default = json_default 
開發者ID:keeprocking,項目名稱:pygelf,代碼行數:22,代碼來源:handlers.py

示例2: __init__

# 需要導入模塊: from logging import Handler [as 別名]
# 或者: from logging.Handler import __init__ [as 別名]
def __init__(self, conn, queue='log', retry_counts=3, auto_persistence=True):
        Handler.__init__(self)
        self.conn = conn
        self.queue = queue
        assert retry_counts > 0
        self.retry_counts = retry_counts
        self.auto_persistence = auto_persistence
        self.cached_logs = []
        if self.auto_persistence:
            gevent.spawn(self.auto_push)
            atexit.register(self.process_cached_log) 
開發者ID:momosecurity,項目名稱:aswan,代碼行數:13,代碼來源:handler.py

示例3: __init__

# 需要導入模塊: from logging import Handler [as 別名]
# 或者: from logging.Handler import __init__ [as 別名]
def __init__(self, filter_components):
        self.inclusive, self.exclusive = self._partition(filter_components)

    # @staticmethod 
開發者ID:singhj,項目名稱:locality-sensitive-hashing,代碼行數:6,代碼來源:logcapture.py

示例4: __init__

# 需要導入模塊: from logging import Handler [as 別名]
# 或者: from logging.Handler import __init__ [as 別名]
def __init__(self, context=None):
        self._set_context(context) 
開發者ID:apache,項目名稱:airflow,代碼行數:4,代碼來源:logging_mixin.py

示例5: __init__

# 需要導入模塊: from logging import Handler [as 別名]
# 或者: from logging.Handler import __init__ [as 別名]
def __init__(self, parent=None):
        QtCore.QObject.__init__(self, parent)
        Handler.__init__(self) 
開發者ID:ralph-group,項目名稱:pymeasure,代碼行數:5,代碼來源:log.py

示例6: __init__

# 需要導入模塊: from logging import Handler [as 別名]
# 或者: from logging.Handler import __init__ [as 別名]
def __init__(self, *args, **kwargs):
        Handler.__init__(self, *args, **kwargs)
        self.errors = [] 
開發者ID:CanonicalLtd,項目名稱:landscape-client,代碼行數:5,代碼來源:testing.py

示例7: __init__

# 需要導入模塊: from logging import Handler [as 別名]
# 或者: from logging.Handler import __init__ [as 別名]
def __init__(self, api_key, channel, stack_trace=True, username='Python logger', icon_url=None, icon_emoji=None,
                 fail_silent=False, ping_users=None, ping_level=None):
        Handler.__init__(self)
        self.formatter = NoStacktraceFormatter()

        self.stack_trace = stack_trace
        self.fail_silent = fail_silent

        self.slacker = slacker.Slacker(api_key)

        self.username = username
        self.icon_url = icon_url
        self.icon_emoji = icon_emoji if (icon_emoji or icon_url) else DEFAULT_EMOJI
        self.channel = channel
        if not self.channel.startswith('#') and not self.channel.startswith('@'):
            self.channel = '#' + self.channel

        self.ping_level = ping_level
        self.ping_users = []

        if ping_users:
            user_list = self.slacker.users.list().body['members']

            for ping_user in ping_users:
                ping_user = ping_user.lstrip('@')

                for user in user_list:
                    if user['name'] == ping_user:
                        self.ping_users.append(user['id'])
                        break
                else:
                    raise RuntimeError('User not found in Slack users list: %s' % ping_user) 
開發者ID:mathiasose,項目名稱:slacker_log_handler,代碼行數:34,代碼來源:__init__.py

示例8: __init__

# 需要導入模塊: from logging import Handler [as 別名]
# 或者: from logging.Handler import __init__ [as 別名]
def __init__(self, prefix='', only_from=None):
        Formatter.__init__(self)
        self._info_fmt = prefix + "%(message)s"
        self._fmt = prefix + "%(levelname)s (%(name)s): %(message)s"
        self._only_from = only_from 
開發者ID:zchengquan,項目名稱:TextDetector,代碼行數:7,代碼來源:logger.py

示例9: __init__

# 需要導入模塊: from logging import Handler [as 別名]
# 或者: from logging.Handler import __init__ [as 別名]
def __init__(self, base_url=None):
        if(base_url is None):
            self.base_url = 'https://logs-01.loggly.com/inputs/b121e4df-f910-4d6a-b6c1-b19ca2776233/tag/python/'
        else:
            self.base_url = base_url
        self.localip = socket.gethostbyname(socket.gethostname())
        self.publicip = urllib2.urlopen('http://ip.42.pl/raw').read()
        Handler.__init__(self) 
開發者ID:gosquadron,項目名稱:squadron,代碼行數:10,代碼來源:LogglyHandler.py


注:本文中的logging.Handler.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。