1
0
mirror of https://github.com/gabime/spdlog.git synced 2025-01-16 01:37:58 +00:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Gabi Melman
e059ebf99d
Merge pull request #1807 from ChristianPanov/patch-1
Initializer list style consistency
2021-01-21 03:02:26 +02:00
Gabi Melman
609480ed78
Merge pull request #1798 from gv-me/constexpr-log-levels
add constexpr to SPDLOG_LEVEL_NAMES declaration
2021-01-21 03:00:49 +02:00
Gabi Melman
4271185936
Merge pull request #1805 from sillykelvin/patch-1
fix compiling error and typo
2021-01-21 02:56:53 +02:00
Christian Panov
aacae62591
Initializer list style consistency 2021-01-20 20:11:34 +02:00
Kelvin Hu
47cbf3828d
fix compiling error and typo 2021-01-19 22:03:47 +08:00
Gaurav Vaidya
ede8d84884 fix constexpr declaration for c++11 2021-01-11 11:25:27 +01:00
Gaurav Vaidya
53d223b45f add constexpr to SPDLOG_LEVEL_NAMES declaration
for #1791
2021-01-11 11:16:06 +01:00
5 changed files with 12 additions and 6 deletions

View File

@ -9,11 +9,15 @@
namespace spdlog {
namespace level {
#if __cplusplus >= 201402L
constexpr
#endif
static string_view_t level_string_views[] SPDLOG_LEVEL_NAMES;
static const char *short_level_names[] SPDLOG_SHORT_LEVEL_NAMES;
SPDLOG_INLINE string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
SPDLOG_INLINE const string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT
{
return level_string_views[l];
}

View File

@ -166,7 +166,7 @@ enum level_enum
}
#endif
SPDLOG_API string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
SPDLOG_API const string_view_t &to_string_view(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
SPDLOG_API const char *to_short_c_str(spdlog::level::level_enum l) SPDLOG_NOEXCEPT;
SPDLOG_API spdlog::level::level_enum from_str(const std::string &name) SPDLOG_NOEXCEPT;

View File

@ -26,7 +26,9 @@ SPDLOG_INLINE log_msg_buffer::log_msg_buffer(const log_msg_buffer &other)
update_string_views();
}
SPDLOG_INLINE log_msg_buffer::log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT : log_msg{other}, buffer{std::move(other.buffer)}
SPDLOG_INLINE log_msg_buffer::log_msg_buffer(log_msg_buffer &&other) SPDLOG_NOEXCEPT
: log_msg{other}
, buffer{std::move(other.buffer)}
{
update_string_views();
}

View File

@ -129,7 +129,7 @@ public:
void format(const details::log_msg &msg, const std::tm &, memory_buf_t &dest) override
{
string_view_t &level_name = level::to_string_view(msg.level);
const string_view_t &level_name = level::to_string_view(msg.level);
ScopedPadder p(level_name.size(), padinfo_, dest);
fmt_helper::append_string_view(level_name, dest);
}

View File

@ -22,7 +22,7 @@ namespace spdlog {
namespace sinks {
/*
* Generator of Houlry log file names in format basename.YYYY-MM-DD-HH.ext
* Generator of Hourly log file names in format basename.YYYY-MM-DD-HH.ext
*/
struct hourly_filename_calculator
{
@ -156,7 +156,7 @@ private:
if (!ok)
{
filenames_q_.push_back(std::move(current_file));
throw_spdlog_ex("Failed removing hourly file " + filename_to_str(old_filename), errno);
SPDLOG_THROW(spdlog_ex("Failed removing hourly file " + filename_to_str(old_filename), errno));
}
}
filenames_q_.push_back(std::move(current_file));