SmartLockerTools/Analyser/CategoryLogSinkBackend.h
2024-06-13 15:41:40 +08:00

21 lines
635 B
C++

#ifndef __CATEGORYLOGSINKBACKEND_H__
#define __CATEGORYLOGSINKBACKEND_H__
#include <boost/log/sinks.hpp>
#include <functional>
#include <string>
class CategoryLogSinkBackend
: public boost::log::sinks::basic_formatted_sink_backend<char, boost::log::sinks::synchronized_feeding> {
public:
using Append = std::function<void(const std::string &)>;
CategoryLogSinkBackend(const std::string &category, Append &&append);
void consume(const boost::log::record_view &record, string_type const &output);
private:
std::string m_category;
Append m_append;
};
#endif // __CATEGORYLOGSINKBACKEND_H__