mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 01:29:35 +08:00
Updated clang format to google style
This commit is contained in:
@@ -8,30 +8,25 @@
|
||||
|
||||
namespace spdlog {
|
||||
|
||||
spdlog::level level_from_str(const std::string &name) noexcept
|
||||
{
|
||||
spdlog::level level_from_str(const std::string &name) noexcept {
|
||||
auto it = std::find(std::begin(level_string_views), std::end(level_string_views), name);
|
||||
if (it != std::end(level_string_views))
|
||||
return static_cast<level>(std::distance(std::begin(level_string_views), it));
|
||||
|
||||
// check also for "warn" and "err" before giving up..
|
||||
if (name == "warn")
|
||||
{
|
||||
if (name == "warn") {
|
||||
return spdlog::level::warn;
|
||||
}
|
||||
if (name == "err")
|
||||
{
|
||||
if (name == "err") {
|
||||
return level::err;
|
||||
}
|
||||
return level::off;
|
||||
}
|
||||
|
||||
spdlog_ex::spdlog_ex(std::string msg)
|
||||
: msg_(std::move(msg))
|
||||
{}
|
||||
: msg_(std::move(msg)) {}
|
||||
|
||||
spdlog_ex::spdlog_ex(const std::string &msg, int last_errno)
|
||||
{
|
||||
spdlog_ex::spdlog_ex(const std::string &msg, int last_errno) {
|
||||
#ifdef SPDLOG_USE_STD_FORMAT
|
||||
msg_ = std::system_error(std::error_code(last_errno, std::generic_category()), msg).what();
|
||||
#else
|
||||
@@ -41,19 +36,10 @@ spdlog_ex::spdlog_ex(const std::string &msg, int last_errno)
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *spdlog_ex::what() const noexcept
|
||||
{
|
||||
return msg_.c_str();
|
||||
}
|
||||
const char *spdlog_ex::what() const noexcept { return msg_.c_str(); }
|
||||
|
||||
void throw_spdlog_ex(const std::string &msg, int last_errno)
|
||||
{
|
||||
SPDLOG_THROW(spdlog_ex(msg, last_errno));
|
||||
}
|
||||
void throw_spdlog_ex(const std::string &msg, int last_errno) { SPDLOG_THROW(spdlog_ex(msg, last_errno)); }
|
||||
|
||||
void throw_spdlog_ex(std::string msg)
|
||||
{
|
||||
SPDLOG_THROW(spdlog_ex(std::move(msg)));
|
||||
}
|
||||
void throw_spdlog_ex(std::string msg) { SPDLOG_THROW(spdlog_ex(std::move(msg))); }
|
||||
|
||||
} // namespace spdlog
|
||||
|
Reference in New Issue
Block a user