wip static-lib

This commit is contained in:
gabime
2019-05-12 23:36:48 +03:00
parent d5c9bac3c7
commit 26a064ed2d
4 changed files with 53 additions and 20 deletions

View File

@@ -23,28 +23,12 @@ template<typename Mutex>
class basic_file_sink final : public base_sink<Mutex>
{
public:
explicit basic_file_sink(const filename_t &filename, bool truncate = false)
{
file_helper_.open(filename, truncate);
}
const filename_t &filename() const
{
return file_helper_.filename();
}
explicit basic_file_sink(const filename_t &filename, bool truncate = false);
const filename_t &filename() const;
protected:
void sink_it_(const details::log_msg &msg) override
{
fmt::memory_buffer formatted;
sink::formatter_->format(msg, formatted);
file_helper_.write(formatted);
}
void flush_() override
{
file_helper_.flush();
}
void sink_it_(const details::log_msg &msg) override;
void flush_() override;
private:
details::file_helper file_helper_;
@@ -71,3 +55,7 @@ inline std::shared_ptr<logger> basic_logger_st(const std::string &logger_name, c
}
} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
#include "basic_file_sink-inl.h"
#endif