Skip to content

Commit

Permalink
Update ColorLogging.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
nefarius committed Aug 7, 2024
1 parent fe0979b commit a8bb7e8
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/ColorLogging.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
#include "colorwin.hpp"
#include <easylogging++.h>

using namespace colorwin;

class ConsoleColorLogDispatchCallback : public el::LogDispatchCallback
{
std::unordered_map<el::Level, CW_COLORS> logLevelToColor = {
{el::Level::Debug, white},
{el::Level::Info, green},
{el::Level::Warning, yellow},
{el::Level::Error, red},
{el::Level::Fatal, magenta},
{el::Level::Verbose, white}
std::unordered_map<el::Level, colorwin::CW_COLORS> logLevelToColor = {
{el::Level::Debug, colorwin::white},
{el::Level::Info, colorwin::green},
{el::Level::Warning, colorwin::yellow},
{el::Level::Error, colorwin::red},
{el::Level::Fatal, colorwin::magenta},
{el::Level::Verbose, colorwin::white}
};

protected:
Expand All @@ -40,7 +39,7 @@ class ConsoleColorLogDispatchCallback : public el::LogDispatchCallback

// scoped color
{
std::cout << timestamp << " " << color(logLevelToColor[logMessage->level()]) << level;
std::cout << timestamp << " " << colorwin::color(logLevelToColor[logMessage->level()]) << level;
}
std::cout << " " << message << '\n';
}
Expand Down

0 comments on commit a8bb7e8

Please sign in to comment.