From 36b3ad8154e581b5530612be89a557c7a72be5be Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Mon, 24 Feb 2020 02:15:45 -0800 Subject: [PATCH] Add an optional context string for status line messges --- src/boot/console.cpp | 8 +++++++- src/boot/console.h | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/boot/console.cpp b/src/boot/console.cpp index 22a7ffc..27057e4 100644 --- a/src/boot/console.cpp +++ b/src/boot/console.cpp @@ -272,7 +272,7 @@ console::print(const wchar_t *fmt, ...) return result; } -status_line::status_line(const wchar_t *message) : +status_line::status_line(const wchar_t *message, const wchar_t *context) : m_level(level_ok) { auto out = console::get().m_out; @@ -283,6 +283,12 @@ status_line::status_line(const wchar_t *message) : out->set_cursor_position(indent, m_line); out->set_attribute(uefi::attribute::light_gray); out->output_string(message); + + if (context) { + out->output_string(L": "); + out->output_string(context); + } + out->output_string(L"\r\n"); m_next = s_current; diff --git a/src/boot/console.h b/src/boot/console.h index c5a70ad..a97c4d2 100644 --- a/src/boot/console.h +++ b/src/boot/console.h @@ -35,14 +35,14 @@ private: class status_line { public: - status_line(const wchar_t *message); + status_line(const wchar_t *message, const wchar_t *context = nullptr); ~status_line(); - inline static void warn(const wchar_t *message, const wchar_t *error=nullptr) { + inline static void warn(const wchar_t *message, const wchar_t *error = nullptr) { if (s_current) s_current->do_warn(message, error); } - inline static void fail(const wchar_t *message, const wchar_t *error=nullptr) { + inline static void fail(const wchar_t *message, const wchar_t *error = nullptr) { if (s_current) s_current->do_fail(message, error); }