Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <boost/log/core.hpp>
- #include <boost/log/trivial.hpp>
- #include <boost/log/expressions.hpp>
- #include <boost/log/sinks/text_file_backend.hpp>
- #include <boost/log/utility/setup/file.hpp>
- #include <boost/log/utility/setup/common_attributes.hpp>
- #include <boost/log/sources/severity_logger.hpp>
- #include <boost/log/sources/record_ostream.hpp>
- #include <mexc_spot/types.hpp>
- #include <mexc_spot/errors.hpp>
- namespace logging = boost::log;
- namespace src = boost::log::sources;
- namespace sinks = boost::log::sinks;
- namespace keywords = boost::log::keywords;
- namespace mira {
- namespace mexc_spot {
- class BaseMexcLogger { // дальше наследоваться будем скорее всего
- public:
- BaseMexcLogger() {
- logging::add_file_log(
- keywords::file_name = SetAndGetLogPath(),
- keywords::rotation_size = 300 * 1024 * 1024, // 300мб: потом внести в параметры (скорее всего размер от типа логгера будет зависеть)
- keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0), // сброс в 00:00
- keywords::format = "[%TimeStamp%]: %Message%"
- );
- logging::core::get()->set_filter(
- logging::trivial::severity < logging::trivial::info
- );
- }
- private:
- std::string& SetAndGetLogPath() {
- path_to_log_ = "/usr/mnt/log/mock.log"; // TODO - ко времени привязаться + к типу логгера
- return path_to_log_;
- }
- std::string path_to_log_;
- };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement