47 for (
int tries = 0; tries <
open_tries; ++tries)
62 if (_filename.empty())
64 throw spdlog_ex(
"Failed re opening file - was not opened before");
66 open(_filename, truncate);
85 size_t msg_size = buf.
size();
87 if (std::fwrite(
data, 1, msg_size, fd_) != msg_size)
127 auto ext_index = fname.rfind(
'.');
131 if (ext_index == filename_t::npos || ext_index == 0 || ext_index == fname.size() - 1)
138 if (folder_index != filename_t::npos && folder_index >= ext_index - 1)
144 return std::make_tuple(fname.substr(0, ext_index), fname.substr(ext_index));
148 std::FILE *fd_{
nullptr};
void sleep_for_millis(int milliseconds) noexcept
void open(const filename_t &fname, bool truncate=false)
void reopen(bool truncate)
static std::tuple< filename_t, filename_t > split_by_extension(const spdlog::filename_t &fname)
void write(const fmt::memory_buffer &buf)
bool fopen_s(FILE **fp, const filename_t &filename, const filename_t &mode)
const filename_t & filename() const
file_helper & operator=(const file_helper &)=delete
static bool file_exists(const filename_t &fname)
#define SPDLOG_FILENAME_T(s)
bool file_exists(const filename_t &filename) noexcept
static constexpr const char folder_sep
std::string filename_to_str(const filename_t &filename)