diff --git a/doomsday/client/include/ui/styledlogsinkformatter.h b/doomsday/client/include/ui/styledlogsinkformatter.h index ad8c0feab8..b361fc2374 100644 --- a/doomsday/client/include/ui/styledlogsinkformatter.h +++ b/doomsday/client/include/ui/styledlogsinkformatter.h @@ -28,7 +28,13 @@ class StyledLogSinkFormatter : public de::LogSink::IFormatter { public: + StyledLogSinkFormatter(); + StyledLogSinkFormatter(de::LogEntry::Flags const &formatFlags); + Lines logEntryToTextLines(de::LogEntry const &entry); + +private: + de::LogEntry::Flags _format; }; #endif // DENG_CLIENT_STYLEDLOGSINKFORMATTER_H diff --git a/doomsday/client/src/ui/styledlogsinkformatter.cpp b/doomsday/client/src/ui/styledlogsinkformatter.cpp index c516b77497..3c0d7706ed 100644 --- a/doomsday/client/src/ui/styledlogsinkformatter.cpp +++ b/doomsday/client/src/ui/styledlogsinkformatter.cpp @@ -20,16 +20,23 @@ using namespace de; -LogSink::IFormatter::Lines StyledLogSinkFormatter::logEntryToTextLines(LogEntry const &entry) +StyledLogSinkFormatter::StyledLogSinkFormatter() { - LogEntry::Flags flags = LogEntry::Styled | LogEntry::OmitLevel; + _format = LogEntry::Styled | LogEntry::OmitLevel; #ifndef _DEBUG // No metadata in release builds. - flags |= LogEntry::Simple; + _format |= LogEntry::Simple; #endif +} + +StyledLogSinkFormatter::StyledLogSinkFormatter(LogEntry::Flags const &formatFlags) + : _format(formatFlags) +{} +LogSink::IFormatter::Lines StyledLogSinkFormatter::logEntryToTextLines(LogEntry const &entry) +{ // This will form a single long line. The line wrapper will // then determine how to wrap it onto the available width. - return Lines() << entry.asText(flags); + return Lines() << entry.asText(_format); }