You are viewing the documentation for a prerelease version. View Latest

nvda.log

Structured log records, and assert_no_errors() for the common case of "my add-on shouldn’t have logged anything alarming."

def test_the_installed_addon_logs_at_startup(nvda, addon_under_test):
    nvda.restart_harness()
    nvda.log.wait_for(re.escape(STARTUP_MESSAGE), since=0, timeout=20)

wait_for takes a regex and an index to search from — pass since=0 (as above) to search the whole session, or since=nvda.log.index() taken earlier to ignore anything logged before that point.

errors() and warnings() filter by level; assert_no_errors() raises with the offending records attached instead of returning a bare False.