summaryrefslogtreecommitdiff
path: root/include/color_cout_g3_sink.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/color_cout_g3_sink.hpp')
-rw-r--r--include/color_cout_g3_sink.hpp41
1 files changed, 22 insertions, 19 deletions
diff --git a/include/color_cout_g3_sink.hpp b/include/color_cout_g3_sink.hpp
index cd98fac05d..a92bf9432e 100644
--- a/include/color_cout_g3_sink.hpp
+++ b/include/color_cout_g3_sink.hpp
@@ -1,26 +1,29 @@
#pragma once
-namespace crow
-{
- struct ColorCoutSink {
-
+namespace crow {
+struct ColorCoutSink {
// Linux xterm color
// http://stackoverflow.com/questions/2616906/how-do-i-output-coloured-text-to-a-linux-terminal
- enum FG_Color {YELLOW = 33, RED = 31, GREEN=32, WHITE = 97};
-
- FG_Color GetColor(const LEVELS level) const {
- if (level.value == WARNING.value) { return YELLOW; }
- if (level.value == DEBUG.value) { return GREEN; }
- if (g3::internal::wasFatal(level)) { return RED; }
+ enum FG_Color { YELLOW = 33, RED = 31, GREEN = 32, WHITE = 97 };
- return WHITE;
+ FG_Color GetColor(const LEVELS level) const {
+ if (level.value == WARNING.value) {
+ return YELLOW;
}
-
- void ReceiveLogMessage(g3::LogMessageMover logEntry) {
- auto level = logEntry.get()._level;
- auto color = GetColor(level);
-
- std::cout << "\033[" << color << "m"
- << logEntry.get().toString() << "\033[m";
+ if (level.value == DEBUG.value) {
+ return GREEN;
+ }
+ if (g3::internal::wasFatal(level)) {
+ return RED;
}
- };
+
+ return WHITE;
+ }
+
+ void ReceiveLogMessage(g3::LogMessageMover logEntry) {
+ auto level = logEntry.get()._level;
+ auto color = GetColor(level);
+
+ std::cout << "\033[" << color << "m" << logEntry.get().toString() << "\033[m";
+ }
+};
} \ No newline at end of file