SmartLockerTools/Analyser/CategoryLogSinkBackend.h

21 lines
635 B
C
Raw Permalink Normal View History

2024-05-21 21:09:55 +08:00
#ifndef __CATEGORYLOGSINKBACKEND_H__
#define __CATEGORYLOGSINKBACKEND_H__
#include <boost/log/sinks.hpp>
2024-06-13 15:41:40 +08:00
#include <functional>
2024-05-21 21:09:55 +08:00
#include <string>
class CategoryLogSinkBackend
: public boost::log::sinks::basic_formatted_sink_backend<char, boost::log::sinks::synchronized_feeding> {
public:
2024-06-13 15:41:40 +08:00
using Append = std::function<void(const std::string &)>;
CategoryLogSinkBackend(const std::string &category, Append &&append);
2024-05-21 21:09:55 +08:00
void consume(const boost::log::record_view &record, string_type const &output);
private:
std::string m_category;
2024-06-13 15:41:40 +08:00
Append m_append;
2024-05-21 21:09:55 +08:00
};
#endif // __CATEGORYLOGSINKBACKEND_H__