Commit 63e0012e authored by Denis Ivaykin's avatar Denis Ivaykin

flush in logger

parent 849b5cb8
...@@ -312,4 +312,8 @@ inline void spdlog::logger::_set_formatter(formatter_ptr msg_formatter) ...@@ -312,4 +312,8 @@ inline void spdlog::logger::_set_formatter(formatter_ptr msg_formatter)
_formatter = msg_formatter; _formatter = msg_formatter;
} }
inline void spdlog::logger::flush() {
for (auto& sink : _sinks) {
sink->flush();
}
}
\ No newline at end of file
...@@ -107,6 +107,7 @@ public: ...@@ -107,6 +107,7 @@ public:
void set_pattern(const std::string&); void set_pattern(const std::string&);
void set_formatter(formatter_ptr); void set_formatter(formatter_ptr);
void flush();
protected: protected:
virtual void _log_msg(details::log_msg&); virtual void _log_msg(details::log_msg&);
......
...@@ -58,8 +58,6 @@ public: ...@@ -58,8 +58,6 @@ public:
_sink_it(msg); _sink_it(msg);
} }
virtual void flush() = 0;
protected: protected:
virtual void _sink_it(const details::log_msg& msg) = 0; virtual void _sink_it(const details::log_msg& msg) = 0;
Mutex _mutex; Mutex _mutex;
......
...@@ -35,6 +35,7 @@ class sink ...@@ -35,6 +35,7 @@ class sink
public: public:
virtual ~sink() {} virtual ~sink() {}
virtual void log(const details::log_msg& msg) = 0; virtual void log(const details::log_msg& msg) = 0;
virtual void flush() = 0;
}; };
} }
} }
......
...@@ -78,6 +78,8 @@ public: ...@@ -78,6 +78,8 @@ public:
::syslog(syslog_prio_from_level(msg), "%s", msg.formatted.str().c_str()); ::syslog(syslog_prio_from_level(msg), "%s", msg.formatted.str().c_str());
} }
virtual void flush() override {
}
private: private:
......
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