mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
Add an optional context string for status line messges
This commit is contained in:
@@ -272,7 +272,7 @@ console::print(const wchar_t *fmt, ...)
|
|||||||
return result;
|
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)
|
m_level(level_ok)
|
||||||
{
|
{
|
||||||
auto out = console::get().m_out;
|
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_cursor_position(indent, m_line);
|
||||||
out->set_attribute(uefi::attribute::light_gray);
|
out->set_attribute(uefi::attribute::light_gray);
|
||||||
out->output_string(message);
|
out->output_string(message);
|
||||||
|
|
||||||
|
if (context) {
|
||||||
|
out->output_string(L": ");
|
||||||
|
out->output_string(context);
|
||||||
|
}
|
||||||
|
|
||||||
out->output_string(L"\r\n");
|
out->output_string(L"\r\n");
|
||||||
|
|
||||||
m_next = s_current;
|
m_next = s_current;
|
||||||
|
|||||||
@@ -35,14 +35,14 @@ private:
|
|||||||
class status_line
|
class status_line
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
status_line(const wchar_t *message);
|
status_line(const wchar_t *message, const wchar_t *context = nullptr);
|
||||||
~status_line();
|
~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);
|
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);
|
if (s_current) s_current->do_fail(message, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user