Moved throw to dedicated function throw_spdlog_ex

This commit is contained in:
Gabi Melman
2020-03-21 23:25:12 +02:00
parent d43a17304e
commit 3b87eb3d08
13 changed files with 32 additions and 19 deletions

View File

@@ -64,7 +64,7 @@ protected:
if (ret < 0)
{
SPDLOG_THROW(spdlog_ex("__android_log_write() failed", ret));
throw_spdlog_ex("__android_log_write() failed", ret);
}
}

View File

@@ -56,7 +56,7 @@ public:
{
if (rotation_hour < 0 || rotation_hour > 23 || rotation_minute < 0 || rotation_minute > 59)
{
SPDLOG_THROW(spdlog_ex("daily_file_sink: Invalid rotation time in ctor"));
throw_spdlog_ex("daily_file_sink: Invalid rotation time in ctor");
}
auto now = log_clock::now();
@@ -164,7 +164,7 @@ private:
if (!ok)
{
filenames_q_.push_back(std::move(current_file));
SPDLOG_THROW(spdlog_ex("Failed removing daily file " + filename_to_str(old_filename), errno));
throw_spdlog_ex("Failed removing daily file " + filename_to_str(old_filename), errno);
}
}
filenames_q_.push_back(std::move(current_file));

View File

@@ -72,7 +72,7 @@ protected:
if (err)
{
SPDLOG_THROW(spdlog_ex("Failed writing to systemd", errno));
throw_spdlog_ex("Failed writing to systemd", errno);
}
}

View File

@@ -91,7 +91,7 @@ public:
{
if (!::IsValidSid(psid))
{
SPDLOG_THROW(spdlog_ex("sid_t::sid_t(): invalid SID received"));
throw_spdlog_ex("sid_t::sid_t(): invalid SID received");
}
auto const sid_length{::GetLengthSid(psid)};

View File

@@ -158,7 +158,7 @@ void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::write_to_file_(const memory_buf_
bool ok = ::WriteFile(out_handle_, formatted.data() + total_written, size - total_written, &bytes_written, nullptr) != 0;
if (!ok || bytes_written == 0)
{
SPDLOG_THROW(spdlog_ex("wincolor_sink: write_to_file_ failed. GetLastError(): " + std::to_string(::GetLastError())));
throw_spdlog_ex("wincolor_sink: write_to_file_ failed. GetLastError(): " + std::to_string(::GetLastError()));
}
total_written += bytes_written;
} while (total_written < size);