elogger.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:pylogging 作者: ansrivas 项目源码 文件源码
def __init__(self, app_name, elastic_url, headers=None, auth=None):
        """Initialize the ElasticLoggger class.

        Args:
            app_name (str)    :Name of the application which is using current logger
            elastic_url (str) :Url of elastic-http-input to push logs to (for eg. 'http://localhost:3332' )
            headers (str)     :Since this is post request headers are required, defaults to {'content-type': 'application/json'}
            auth (tuple)      :A tuple containing username and password: for eg.  ('myuser', 'mypassword')
        """
        self.elastic_url = elastic_url
        self.auth = auth
        self.headers = headers
        if not self.headers:
            self.headers = {'content-type': 'application/json'}

        self.debug_method = partial(self.__log, level='debug')
        self.error_method = partial(self.__log, level='error')
        self.info_method = partial(self.__log, level='info')
        self.exception_method = partial(self.__log, level='exception')
        self.session = FuturesSession(max_workers=10)
        self.app_name = app_name
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号