From 8b1ac0912ba0f1572427a088db976f9c9287cefa Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 19 Jan 2020 14:27:23 +0100 Subject: [PATCH] Add reader flog category For both input and reader, because the "reader" term is more general and we don't have enough messages to justify multiple categories --- src/flog.h | 2 ++ src/input.cpp | 2 +- src/input_common.cpp | 3 ++- src/reader.cpp | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/flog.h b/src/flog.h index 5a4acf5a2..111f0476e 100644 --- a/src/flog.h +++ b/src/flog.h @@ -92,6 +92,8 @@ class category_list_t { category_t iothread{L"iothread", L"Background IO thread events"}; category_t term_support{L"term-support", L"Terminal feature detection"}; + + category_t reader{L"reader", L"The interactive reader/input system"}; }; /// The class responsible for logging. diff --git a/src/input.cpp b/src/input.cpp index e2600656d..df0322bbf 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -458,7 +458,7 @@ void inputter_t::mapping_execute_matching_or_generic(bool allow_commands) { if (auto mapping = find_mapping()) { mapping_execute(*mapping, allow_commands); } else { - debug(2, L"no generic found, ignoring char..."); + FLOGF(reader, L"no generic found, ignoring char..."); auto evt = event_queue_.readch(); if (evt.is_eof()) { event_queue_.push_front(evt); diff --git a/src/input_common.cpp b/src/input_common.cpp index 4767a0be0..a7897008f 100644 --- a/src/input_common.cpp +++ b/src/input_common.cpp @@ -24,6 +24,7 @@ #include "env.h" #include "env_universal_common.h" #include "fallback.h" // IWYU pragma: keep +#include "flog.h" #include "global_safety.h" #include "input_common.h" #include "iothread.h" @@ -188,7 +189,7 @@ char_event_t input_event_queue_t::readch() { switch (sz) { case static_cast(-1): { std::memset(&state, '\0', sizeof(state)); - debug(2, L"Illegal input"); + FLOG(reader, L"Illegal input"); return char_event_type_t::check_exit; } case static_cast(-2): { diff --git a/src/reader.cpp b/src/reader.cpp index a7b0468ff..ecd38b263 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -3311,7 +3311,7 @@ maybe_t reader_data_t::readline(int nchars_or_0) { } else { // This can happen if the user presses a control char we don't recognize. No // reason to report this to the user unless they've enabled debugging output. - debug(2, _(L"Unknown key binding 0x%X"), c); + FLOGF(reader, _(L"Unknown key binding 0x%X"), c); } rls.last_cmd = none(); }