本文整理汇总了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()