本文整理匯總了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)
示例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', ''))
示例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
示例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)
示例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()