Agora
1.2.0
Agora project
|
Go to the documentation of this file.
6 #ifndef SPDLOG_HEADER_ONLY
19 # ifndef _USING_V110_SDK71_ // fileapi.h doesn't exist in winxp
31 template<
typename ConsoleMutex>
33 : mutex_(ConsoleMutex::mutex())
40 handle_ =
reinterpret_cast<HANDLE
>(::_get_osfhandle(::_fileno(
file_)));
45 if (handle_ == INVALID_HANDLE_VALUE && file != stdout && file != stderr)
47 throw_spdlog_ex(
"spdlog::stdout_sink_base: _get_osfhandle() failed", errno);
52 template<
typename ConsoleMutex>
56 if (handle_ == INVALID_HANDLE_VALUE)
60 std::lock_guard<mutex_t> lock(mutex_);
62 formatter_->format(msg, formatted);
64 auto size =
static_cast<DWORD
>(formatted.
size());
65 DWORD bytes_written = 0;
66 bool ok = ::WriteFile(handle_, formatted.
data(),
size, &bytes_written,
nullptr) != 0;
72 std::lock_guard<mutex_t> lock(mutex_);
74 formatter_->format(msg, formatted);
80 template<
typename ConsoleMutex>
83 std::lock_guard<mutex_t> lock(mutex_);
87 template<
typename ConsoleMutex>
90 std::lock_guard<mutex_t> lock(mutex_);
94 template<
typename ConsoleMutex>
97 std::lock_guard<mutex_t> lock(mutex_);
98 formatter_ = std::move(sink_formatter);
102 template<
typename ConsoleMutex>
108 template<
typename ConsoleMutex>
116 template<
typename Factory>
119 return Factory::template create<sinks::stdout_sink_mt>(logger_name);
122 template<
typename Factory>
125 return Factory::template create<sinks::stdout_sink_st>(logger_name);
128 template<
typename Factory>
131 return Factory::template create<sinks::stderr_sink_mt>(logger_name);
134 template<
typename Factory>
137 return Factory::template create<sinks::stderr_sink_st>(logger_name);
end IFFT Reshape the symbol vector into two different spatial streams size
Definition: generate_data.m:73
SPDLOG_INLINE std::shared_ptr< logger > stdout_logger_mt(const std::string &logger_name)
Definition: stdout_sinks-inl.h:117
SPDLOG_INLINE std::shared_ptr< logger > stderr_logger_mt(const std::string &logger_name)
Definition: stdout_sinks-inl.h:129
stdout_sink()
Definition: stdout_sinks-inl.h:103
SPDLOG_INLINE std::shared_ptr< logger > stderr_logger_st(const std::string &logger_name)
Definition: stdout_sinks-inl.h:135
constexpr auto size() const -> size_t
Definition: core.h:820
stdout_sink_base(FILE *file)
Definition: stdout_sinks-inl.h:32
Definition: stdout_sinks.h:20
SPDLOG_INLINE void throw_spdlog_ex(const std::string &msg, int last_errno)
Definition: common-inl.h:72
#define SPDLOG_INLINE
Definition: common.h:42
std::unique_ptr< T > make_unique(Args &&... args)
Definition: common.h:334
auto data() -> T *
Definition: core.h:826
void set_pattern(const std::string &pattern) override
Definition: stdout_sinks-inl.h:88
SPDLOG_INLINE std::shared_ptr< logger > stdout_logger_st(const std::string &logger_name)
Definition: stdout_sinks-inl.h:123
fwrite(fileID, pilot_f, 'float')
void set_formatter(std::unique_ptr< spdlog::formatter > sink_formatter) override
Definition: stdout_sinks-inl.h:95
void log(const details::log_msg &msg) override
Definition: stdout_sinks-inl.h:53
std::string to_string() const
Definition: eth_common.h:64
FILE * file_
Definition: stdout_sinks.h:41
stderr_sink()
Definition: stdout_sinks-inl.h:109
void flush() override
Definition: stdout_sinks-inl.h:81