Public Member Functions | Protected Member Functions | Private Attributes | List of all members
spdlog::sinks::basic_file_sink< Mutex > Class Template Referencefinal

#include <basic_file_sink.h>

Inheritance diagram for spdlog::sinks::basic_file_sink< Mutex >:
spdlog::sinks::base_sink< Mutex > spdlog::sinks::sink

Public Member Functions

 basic_file_sink (const filename_t &filename, bool truncate=false)
 
- Public Member Functions inherited from spdlog::sinks::base_sink< Mutex >
 base_sink ()=default
 
 base_sink (const base_sink &)=delete
 
base_sinkoperator= (const base_sink &)=delete
 
void log (const details::log_msg &msg) final
 
void flush () final
 
void set_pattern (const std::string &pattern) final
 
void set_formatter (std::unique_ptr< spdlog::formatter > sink_formatter) final
 
- Public Member Functions inherited from spdlog::sinks::sink
 sink ()
 
 sink (std::unique_ptr< spdlog::pattern_formatter > formatter)
 
virtual ~sink ()=default
 
bool should_log (level::level_enum msg_level) const
 
void set_level (level::level_enum log_level)
 
level::level_enum level () const
 

Protected Member Functions

void sink_it_ (const details::log_msg &msg) override
 
void flush_ () override
 
- Protected Member Functions inherited from spdlog::sinks::base_sink< Mutex >
virtual void set_pattern_ (const std::string &pattern)
 
virtual void set_formatter_ (std::unique_ptr< spdlog::formatter > sink_formatter)
 

Private Attributes

details::file_helper file_helper_
 

Additional Inherited Members

- Protected Attributes inherited from spdlog::sinks::base_sink< Mutex >
Mutex mutex_
 
- Protected Attributes inherited from spdlog::sinks::sink
level_t level_
 
std::unique_ptr< spdlog::formatterformatter_
 

Detailed Description

template<typename Mutex>
class spdlog::sinks::basic_file_sink< Mutex >

Definition at line 25 of file basic_file_sink.h.

Constructor & Destructor Documentation

template<typename Mutex >
spdlog::sinks::basic_file_sink< Mutex >::basic_file_sink ( const filename_t filename,
bool  truncate = false 
)
inlineexplicit

Definition at line 28 of file basic_file_sink.h.

29  {
30  file_helper_.open(filename, truncate);
31  }
void open(const filename_t &fname, bool truncate=false)
Definition: file_helper.h:42
string filename
Definition: train.py:213
details::file_helper file_helper_

Member Function Documentation

template<typename Mutex >
void spdlog::sinks::basic_file_sink< Mutex >::flush_ ( )
inlineoverrideprotectedvirtual

Implements spdlog::sinks::base_sink< Mutex >.

Definition at line 41 of file basic_file_sink.h.

42  {
44  }
details::file_helper file_helper_
template<typename Mutex >
void spdlog::sinks::basic_file_sink< Mutex >::sink_it_ ( const details::log_msg msg)
inlineoverrideprotectedvirtual

Implements spdlog::sinks::base_sink< Mutex >.

Definition at line 34 of file basic_file_sink.h.

35  {
36  fmt::memory_buffer formatted;
37  sink::formatter_->format(msg, formatted);
38  file_helper_.write(formatted);
39  }
basic_memory_buffer< char > memory_buffer
Definition: format.h:553
void msg(const char *fmt,...)
Definition: message.cpp:107
std::unique_ptr< spdlog::formatter > formatter_
Definition: sink.h:55
void write(const fmt::memory_buffer &buf)
Definition: file_helper.h:83
details::file_helper file_helper_

Member Data Documentation

template<typename Mutex >
details::file_helper spdlog::sinks::basic_file_sink< Mutex >::file_helper_
private

Definition at line 47 of file basic_file_sink.h.


The documentation for this class was generated from the following file: