本文整理汇总了Python中flak.Flak.logger_name方法的典型用法代码示例。如果您正苦于以下问题:Python Flak.logger_name方法的具体用法?Python Flak.logger_name怎么用?Python Flak.logger_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flak.Flak
的用法示例。
在下文中一共展示了Flak.logger_name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_logger_cache
# 需要导入模块: from flak import Flak [as 别名]
# 或者: from flak.Flak import logger_name [as 别名]
def test_logger_cache(self):
app = Flak(__name__)
logger1 = app.logger
assert app.logger is logger1
assert logger1.name == __name__
app.logger_name = __name__ + "/test_logger_cache"
assert app.logger is not logger1
示例2: test_exception_logging
# 需要导入模块: from flak import Flak [as 别名]
# 或者: from flak.Flak import logger_name [as 别名]
def test_exception_logging(self):
out = StringIO()
app = Flak(__name__)
app.config["LOGGER_HANDLER_POLICY"] = "never"
app.logger_name = "flak_tests/test_exception_logging"
app.logger.addHandler(StreamHandler(out))
@app.route("/")
def index(cx):
1 // 0
rv = app.test_client().get("/")
assert rv.status_code == 500
assert b"Internal Server Error" in rv.data
err = out.getvalue()
assert "Exception on / [GET]" in err
assert "Traceback (most recent call last):" in err
assert "1 // 0" in err
assert "ZeroDivisionError:" in err
示例3: test_debug_log_override
# 需要导入模块: from flak import Flak [as 别名]
# 或者: from flak.Flak import logger_name [as 别名]
def test_debug_log_override(self):
app = Flak(__name__)
app.debug = True
app.logger_name = "flak_tests/test_debug_log_override"
app.logger.level = 10
assert app.logger.level == 10