diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-09-08 10:33:01 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-09-08 10:33:01 -0400 |
commit | 3705ee8fe4771be7b3dce0530cddecf26cff45ce (patch) | |
tree | b31a4675115da4630e570e268caafb14e0b2fe7a /src/test/log_test_helpers.c | |
parent | ae3ea9a7a1ff0733d6e80734cd984495aeac6247 (diff) | |
download | tor-3705ee8fe4771be7b3dce0530cddecf26cff45ce.tar.gz tor-3705ee8fe4771be7b3dce0530cddecf26cff45ce.zip |
Revise log-testing macros to dump the actual log contents on failure
Diffstat (limited to 'src/test/log_test_helpers.c')
-rw-r--r-- | src/test/log_test_helpers.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/log_test_helpers.c b/src/test/log_test_helpers.c index 1ad008aa50..5eba566d1c 100644 --- a/src/test/log_test_helpers.c +++ b/src/test/log_test_helpers.c @@ -210,3 +210,18 @@ mock_saving_logv(int severity, log_domain_mask_t domain, smartlist_add(saved_logs, e); } +void +mock_dump_saved_logs(void) +{ + if (saved_logs == NULL) { + puts(" Captured logs: NULL"); + return; + } + + puts(" Captured logs:"); + SMARTLIST_FOREACH_BEGIN(saved_logs, const mock_saved_log_entry_t *, m) { + printf("% 5d. %s: %s\n", m_sl_idx + 1, + log_level_to_string(m->severity), + escaped(m->generated_msg)); + } SMARTLIST_FOREACH_END(m); +} |