2019-06-04 05:09:16 +08:00
|
|
|
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
|
2016-04-20 16:57:49 +08:00
|
|
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-04-29 06:31:09 +08:00
|
|
|
#include "spdlog/details/log_msg.h"
|
2018-06-24 06:32:39 +08:00
|
|
|
#include "spdlog/formatter.h"
|
2016-04-20 16:57:49 +08:00
|
|
|
|
2018-03-17 18:47:46 +08:00
|
|
|
namespace spdlog {
|
2019-04-05 21:44:17 +08:00
|
|
|
|
2018-03-17 18:47:46 +08:00
|
|
|
namespace sinks {
|
2016-04-20 16:57:49 +08:00
|
|
|
class sink
|
|
|
|
{
|
|
|
|
public:
|
2018-07-14 21:21:53 +08:00
|
|
|
virtual ~sink() = default;
|
2018-03-09 21:26:33 +08:00
|
|
|
virtual void log(const details::log_msg &msg) = 0;
|
2016-04-20 16:57:49 +08:00
|
|
|
virtual void flush() = 0;
|
2018-07-14 21:21:53 +08:00
|
|
|
virtual void set_pattern(const std::string &pattern) = 0;
|
|
|
|
virtual void set_formatter(std::unique_ptr<spdlog::formatter> sink_formatter) = 0;
|
2016-09-13 04:26:38 +08:00
|
|
|
|
2019-04-05 21:44:17 +08:00
|
|
|
void set_level(level::level_enum log_level);
|
|
|
|
level::level_enum level() const;
|
2019-06-28 04:56:37 +08:00
|
|
|
bool should_log(level::level_enum msg_level) const;
|
2016-09-13 04:26:38 +08:00
|
|
|
|
2018-06-24 06:32:39 +08:00
|
|
|
protected:
|
2018-07-14 21:21:53 +08:00
|
|
|
// sink log level - default is all
|
2019-02-03 23:12:00 +08:00
|
|
|
level_t level_{level::trace};
|
2018-06-24 06:32:39 +08:00
|
|
|
};
|
2016-09-13 04:26:38 +08:00
|
|
|
|
2018-03-17 18:47:46 +08:00
|
|
|
} // namespace sinks
|
|
|
|
} // namespace spdlog
|
2019-04-05 21:44:17 +08:00
|
|
|
|
2019-05-12 05:22:39 +08:00
|
|
|
#ifdef SPDLOG_HEADER_ONLY
|
2019-05-11 18:19:53 +08:00
|
|
|
#include "sink-inl.h"
|
2019-04-27 23:44:48 +08:00
|
|
|
#endif
|