Commit ee610efd authored by Kevin M. Godby's avatar Kevin M. Godby

Add assignment operator to ansi color sink. Adjust default colors.

parent 9afc960d
...@@ -24,6 +24,9 @@ public: ...@@ -24,6 +24,9 @@ public:
ansicolor_sink(sink_ptr sink); ansicolor_sink(sink_ptr sink);
virtual ~ansicolor_sink(); virtual ~ansicolor_sink();
ansicolor_sink(const ansicolor_sink& other);
ansicolor_sink& operator=(const ansicolor_sink& other);
virtual void log(const details::log_msg& msg) override; virtual void log(const details::log_msg& msg) override;
virtual void flush() override; virtual void flush() override;
...@@ -72,10 +75,10 @@ protected: ...@@ -72,10 +75,10 @@ protected:
inline ansicolor_sink::ansicolor_sink(sink_ptr sink) : sink_(sink) inline ansicolor_sink::ansicolor_sink(sink_ptr sink) : sink_(sink)
{ {
colors_[level::trace] = grey; colors_[level::trace] = white;
colors_[level::debug] = grey; colors_[level::debug] = white;
colors_[level::info] = white; colors_[level::info] = white;
colors_[level::notice] = yellow; colors_[level::notice] = bold + white;
colors_[level::warn] = bold + yellow; colors_[level::warn] = bold + yellow;
colors_[level::err] = red; colors_[level::err] = red;
colors_[level::critical] = bold + red; colors_[level::critical] = bold + red;
...@@ -89,6 +92,22 @@ inline ansicolor_sink::~ansicolor_sink() ...@@ -89,6 +92,22 @@ inline ansicolor_sink::~ansicolor_sink()
flush(); flush();
} }
inline ansicolor_sink::ansicolor_sink(const ansicolor_sink& other) : sink_(other.sink_), colors_(other.colors_)
{
// do nothing
}
inline ansicolor_sink& ansicolor_sink::operator=(const ansicolor_sink& other)
{
if (this == &other)
return *this;
sink_ = other.sink_;
colors_ = other.colors_;
return *this;
}
inline void ansicolor_sink::log(const details::log_msg& msg) inline void ansicolor_sink::log(const details::log_msg& msg)
{ {
// Wrap the originally formatted message in color codes // Wrap the originally formatted message in color codes
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment