mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 02:19:35 +08:00
wip static-lib
This commit is contained in:
@@ -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
|
Reference in New Issue
Block a user