本文整理汇总了Python中editxt.application.Application.logger方法的典型用法代码示例。如果您正苦于以下问题:Python Application.logger方法的具体用法?Python Application.logger怎么用?Python Application.logger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类editxt.application.Application
的用法示例。
在下文中一共展示了Application.logger方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_Application_logger
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import logger [as 别名]
def test_Application_logger():
root = logging.getLogger()
app = Application()
handler = app.errlog_handler
assert hasattr(app, "errlog"), app.errlog
assert handler not in root.handlers, root.handlers
with app.logger() as errlog:
handler = app.errlog_handler
assert handler in root.handlers, root.handlers
assert handler not in root.handlers, root.handlers
示例2: test
# 需要导入模块: from editxt.application import Application [as 别名]
# 或者: from editxt.application.Application import logger [as 别名]
def test(c):
m = Mocker()
ed = m.mock(Window)
editor = m.mock(Editor)
app = Application()
with app.logger() as errlog:
err = m.property(app.errlog, "document").value >> m.mock(TextDocument)
if c.is_open:
idocs = iter([editor])
m.method(app.set_current_editor)(editor)
else:
idocs = iter([])
m.method(app.current_window)() >> (ed if c.has_window else None)
if not c.has_window:
m.method(app.create_window)() >> ed
ed.insert_items([err], focus=True)
m.method(app.iter_editors_of_document)(err) >> idocs
with m:
app.open_error_log()