mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-24 06:32:06 +08:00
clang-format
This commit is contained in:
parent
19c7e63858
commit
d1819f5f76
@ -17,16 +17,16 @@
|
|||||||
|
|
||||||
#ifdef SPDLOG_COMPILED_LIB
|
#ifdef SPDLOG_COMPILED_LIB
|
||||||
#undef SPDLOG_HEADER_ONLY
|
#undef SPDLOG_HEADER_ONLY
|
||||||
# if defined(_WIN32) && defined(SPDLOG_SHARED_LIB)
|
#if defined(_WIN32) && defined(SPDLOG_SHARED_LIB)
|
||||||
# ifdef spdlog_EXPORTS
|
#ifdef spdlog_EXPORTS
|
||||||
# define SPDLOG_API __declspec(dllexport)
|
#define SPDLOG_API __declspec(dllexport)
|
||||||
# else
|
#else
|
||||||
# define SPDLOG_API __declspec(dllimport)
|
#define SPDLOG_API __declspec(dllimport)
|
||||||
# endif
|
#endif
|
||||||
# else
|
#else
|
||||||
# define SPDLOG_API
|
#define SPDLOG_API
|
||||||
# endif
|
#endif
|
||||||
# define SPDLOG_INLINE
|
#define SPDLOG_INLINE
|
||||||
#else
|
#else
|
||||||
#define SPDLOG_API
|
#define SPDLOG_API
|
||||||
#define SPDLOG_HEADER_ONLY
|
#define SPDLOG_HEADER_ONLY
|
||||||
|
@ -187,7 +187,7 @@ SPDLOG_INLINE void registry::flush_on(level::level_enum log_level)
|
|||||||
SPDLOG_INLINE void registry::flush_every(std::chrono::seconds interval)
|
SPDLOG_INLINE void registry::flush_every(std::chrono::seconds interval)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(flusher_mutex_);
|
std::lock_guard<std::mutex> lock(flusher_mutex_);
|
||||||
auto clbk = [this](){this->flush_all();};
|
auto clbk = [this]() { this->flush_all(); };
|
||||||
periodic_flusher_ = details::make_unique<periodic_worker>(clbk, interval);
|
periodic_flusher_ = details::make_unique<periodic_worker>(clbk, interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,14 +49,11 @@ class tcp_client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void throw_winsock_error_(const std::string& msg, int last_error)
|
static void throw_winsock_error_(const std::string &msg, int last_error)
|
||||||
{
|
{
|
||||||
char buf[512];
|
char buf[512];
|
||||||
::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, last_error,
|
||||||
NULL,
|
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), buf, (sizeof(buf) / sizeof(char)), NULL);
|
||||||
last_error,
|
|
||||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
|
||||||
buf, (sizeof(buf) / sizeof(char)), NULL);
|
|
||||||
|
|
||||||
SPDLOG_THROW(spdlog_ex(fmt::format("tcp_sink - {}: {}", msg, buf)));
|
SPDLOG_THROW(spdlog_ex(fmt::format("tcp_sink - {}: {}", msg, buf)));
|
||||||
}
|
}
|
||||||
|
@ -46,8 +46,8 @@ public:
|
|||||||
// connect to tcp host/port or throw if failed
|
// connect to tcp host/port or throw if failed
|
||||||
// host can be hostname or ip address
|
// host can be hostname or ip address
|
||||||
|
|
||||||
explicit tcp_sink(tcp_sink_config sink_config):
|
explicit tcp_sink(tcp_sink_config sink_config)
|
||||||
config_{std::move(sink_config)}
|
: config_{std::move(sink_config)}
|
||||||
{
|
{
|
||||||
if (!config_.lazy_connect)
|
if (!config_.lazy_connect)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,11 @@ template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stderr_color_mt<spdl
|
|||||||
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stderr_color_st<spdlog::synchronous_factory>(
|
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stderr_color_st<spdlog::synchronous_factory>(
|
||||||
const std::string &logger_name, color_mode mode);
|
const std::string &logger_name, color_mode mode);
|
||||||
|
|
||||||
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stdout_color_mt<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
|
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stdout_color_mt<spdlog::async_factory>(
|
||||||
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stdout_color_st<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
|
const std::string &logger_name, color_mode mode);
|
||||||
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stderr_color_mt<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
|
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stdout_color_st<spdlog::async_factory>(
|
||||||
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stderr_color_st<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
|
const std::string &logger_name, color_mode mode);
|
||||||
|
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stderr_color_mt<spdlog::async_factory>(
|
||||||
|
const std::string &logger_name, color_mode mode);
|
||||||
|
template SPDLOG_API std::shared_ptr<spdlog::logger> spdlog::stderr_color_st<spdlog::async_factory>(
|
||||||
|
const std::string &logger_name, color_mode mode);
|
||||||
|
@ -209,14 +209,12 @@ TEST_CASE("to_hex_different_size_per_line", "[to_hex]")
|
|||||||
REQUIRE(ends_with(oss.str(), "0000: 090A0B410C4BFFFF" + std::string(spdlog::details::os::default_eol)));
|
REQUIRE(ends_with(oss.str(), "0000: 090A0B410C4BFFFF" + std::string(spdlog::details::os::default_eol)));
|
||||||
|
|
||||||
oss_logger.info("{:Xsa}", spdlog::to_hex(v, 6));
|
oss_logger.info("{:Xsa}", spdlog::to_hex(v, 6));
|
||||||
REQUIRE(ends_with(oss.str(),
|
REQUIRE(ends_with(oss.str(), "0000: 090A0B410C4B ...A.K" + std::string(spdlog::details::os::default_eol) + "0006: FFFF .." +
|
||||||
"0000: 090A0B410C4B ...A.K" + std::string(spdlog::details::os::default_eol)
|
std::string(spdlog::details::os::default_eol)));
|
||||||
+ "0006: FFFF .." + std::string(spdlog::details::os::default_eol)));
|
|
||||||
|
|
||||||
oss_logger.info("{:Xs}", spdlog::to_hex(v, 6));
|
oss_logger.info("{:Xs}", spdlog::to_hex(v, 6));
|
||||||
REQUIRE(ends_with(oss.str(),
|
REQUIRE(ends_with(oss.str(), "0000: 090A0B410C4B" + std::string(spdlog::details::os::default_eol) + "0006: FFFF" +
|
||||||
"0000: 090A0B410C4B" + std::string(spdlog::details::os::default_eol)
|
std::string(spdlog::details::os::default_eol)));
|
||||||
+ "0006: FFFF" + std::string(spdlog::details::os::default_eol)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("to_hex_no_ascii", "[to_hex]")
|
TEST_CASE("to_hex_no_ascii", "[to_hex]")
|
||||||
|
Loading…
Reference in New Issue
Block a user