Add an optional context string for status line messges

This commit is contained in:
Justin C. Miller
2020-02-24 02:15:45 -08:00
parent 460973954e
commit 36b3ad8154
2 changed files with 10 additions and 4 deletions

View File

@@ -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;

View File

@@ -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);
}