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


Python tornado.log方法代碼示例

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


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

示例1: setup_file_loggers

# 需要導入模塊: import tornado [as 別名]
# 或者: from tornado import log [as 別名]
def setup_file_loggers(log_level: str):  # pragma: no cover
    """Handles application, Tornado, and SQLAlchemy logging configuration."""
    os.makedirs('log', exist_ok=True)
    timed_handler = logging.handlers.TimedRotatingFileHandler
    root_logger = logging.getLogger()
    root_logger.removeHandler(root_logger.handlers[0])
    logging.basicConfig(
        format='%(asctime)s %(levelname)s %(message)s',
        handlers=[timed_handler('log/dokomoforms.log', when='D')]
    )
    for log in ('access', 'application', 'general'):
        logger = logging.getLogger('tornado.{}'.format(log))
        handler = timed_handler('log/tornado.{}.log'.format(log), when='D')
        formatter = tornado.log.LogFormatter(color=False, datefmt=None)
        handler.setFormatter(formatter)
        logger.addHandler(handler)
    sql_logger = logging.getLogger('sqlalchemy')
    sql_logger.propagate = False
    sql_logger.setLevel(log_level)
    sql_handler = timed_handler('log/sqlalchemy.log', when='D')
    sql_handler.setLevel(log_level)
    sql_handler.setFormatter(logging.Formatter(
        '%(asctime)s %(levelname)s %(name)s %(message)s'
    ))
    sql_logger.addHandler(sql_handler) 
開發者ID:SEL-Columbia,項目名稱:dokomoforms,代碼行數:27,代碼來源:webapp.py

示例2: login_available

# 需要導入模塊: import tornado [as 別名]
# 或者: from tornado import log [as 別名]
def login_available(self):
        """May a user proceed to log in?

        This returns True if login capability is available, irrespective of
        whether the user is already logged in or not.

        """
        return bool(self.settings.get('password', '')) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:10,代碼來源:handlers.py

示例3: log

# 需要導入模塊: import tornado [as 別名]
# 或者: from tornado import log [as 別名]
def log(self):
        """use the IPython log by default, falling back on tornado's logger"""
        if Application.initialized():
            return Application.instance().log
        else:
            return app_log 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:8,代碼來源:handlers.py

示例4: init_pycurl

# 需要導入模塊: import tornado [as 別名]
# 或者: from tornado import log [as 別名]
def init_pycurl(self):
        try:
            AsyncHTTPClient.configure("tornado.curl_httpclient.CurlAsyncHTTPClient")
        except ImportError as e:
            self.log.debug("Could not load pycurl: %s\npycurl is recommended if you have a large number of users.", e)
        # set max verbosity of curl_httpclient at INFO
        # because debug-logging from curl_httpclient
        # includes every full request and response
        if self.log_level < logging.INFO:
            curl_log = logging.getLogger('tornado.curl_httpclient')
            curl_log.setLevel(logging.INFO) 
開發者ID:jupyterhub,項目名稱:binderhub,代碼行數:13,代碼來源:app.py

示例5: start

# 需要導入模塊: import tornado [as 別名]
# 或者: from tornado import log [as 別名]
def start(self, run_loop=True):
        self.log.info("BinderHub starting on port %i", self.port)
        self.http_server = HTTPServer(
            self.tornado_app,
            xheaders=True,
        )
        self.http_server.listen(self.port)
        if self.builder_required:
            asyncio.ensure_future(self.watch_build_pods())
        if run_loop:
            tornado.ioloop.IOLoop.current().start() 
開發者ID:jupyterhub,項目名稱:binderhub,代碼行數:13,代碼來源:app.py


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