mirror of
https://github.com/gabime/spdlog.git
synced 2025-10-02 11:29:01 +08:00
Print error and abort instead of throw if SPDLOG_NO_EXEPTIONS is defined
This commit is contained in:
@@ -39,14 +39,14 @@ SPDLOG_INLINE void file_helper::open(const filename_t &fname, bool truncate)
|
||||
details::os::sleep_for_millis(open_interval);
|
||||
}
|
||||
|
||||
SPDLOG_THROW spdlog_ex("Failed opening file " + os::filename_to_str(_filename) + " for writing", errno);
|
||||
SPDLOG_THROW(spdlog_ex("Failed opening file " + os::filename_to_str(_filename) + " for writing", errno));
|
||||
}
|
||||
|
||||
SPDLOG_INLINE void file_helper::reopen(bool truncate)
|
||||
{
|
||||
if (_filename.empty())
|
||||
{
|
||||
SPDLOG_THROW spdlog_ex("Failed re opening file - was not opened before");
|
||||
SPDLOG_THROW(spdlog_ex("Failed re opening file - was not opened before"));
|
||||
}
|
||||
open(_filename, truncate);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ SPDLOG_INLINE void file_helper::write(const fmt::memory_buffer &buf)
|
||||
auto data = buf.data();
|
||||
if (std::fwrite(data, 1, msg_size, fd_) != msg_size)
|
||||
{
|
||||
SPDLOG_THROW spdlog_ex("Failed writing to file " + os::filename_to_str(_filename), errno);
|
||||
SPDLOG_THROW(spdlog_ex("Failed writing to file " + os::filename_to_str(_filename), errno));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ SPDLOG_INLINE size_t file_helper::size() const
|
||||
{
|
||||
if (fd_ == nullptr)
|
||||
{
|
||||
SPDLOG_THROW spdlog_ex("Cannot use size() on closed file " + os::filename_to_str(_filename));
|
||||
SPDLOG_THROW(spdlog_ex("Cannot use size() on closed file " + os::filename_to_str(_filename)));
|
||||
}
|
||||
return os::filesize(fd_);
|
||||
}
|
||||
|
Reference in New Issue
Block a user