Photon 1.0.0
Loading...
Searching...
No Matches
basic_file_sink-inl.h
Go to the documentation of this file.
1// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2// Distributed under the MIT License (http://opensource.org/licenses/MIT)
3
4#pragma once
5
6#ifndef SPDLOG_HEADER_ONLY
8#endif
9
10#include <spdlog/common.h>
11#include <spdlog/details/os.h>
12
13namespace spdlog
14{
15 namespace sinks
16 {
17
18 template <typename Mutex>
19 SPDLOG_INLINE basic_file_sink<Mutex>::basic_file_sink(const filename_t& filename, bool truncate, const file_event_handlers& event_handlers)
20 : file_helper_{event_handlers}
21 {
22 file_helper_.open(filename, truncate);
23 }
24
25 template <typename Mutex>
27 {
28 return file_helper_.filename();
29 }
30
31 template <typename Mutex>
33 {
34 memory_buf_t formatted;
35 base_sink<Mutex>::formatter_->format(msg, formatted);
36 file_helper_.write(formatted);
37 }
38
39 template <typename Mutex>
41 {
42 file_helper_.flush();
43 }
44
45 } // namespace sinks
46} // namespace spdlog
void open(const filename_t &fname, bool truncate=false)
Definition file_helper-inl.h:35
Definition base_sink.h:22
void flush() final
Definition base_sink-inl.h:35
details::file_helper file_helper_
Definition basic_file_sink.h:33
const filename_t & filename() const
Definition basic_file_sink-inl.h:26
void sink_it_(const details::log_msg &msg) override
Definition basic_file_sink-inl.h:32
basic_file_sink(const filename_t &filename, bool truncate=false, const file_event_handlers &event_handlers={})
Definition basic_file_sink-inl.h:19
void flush_() override
Definition basic_file_sink-inl.h:40
#define SPDLOG_INLINE
Definition common.h:47
Definition async.h:26
std::string filename_t
Definition common.h:131
fmt::basic_memory_buffer< char, 250 > memory_buf_t
Definition common.h:173
Definition log_msg.h:14
Definition common.h:329