diff --git a/example/example.cpp b/example/example.cpp index b70cc1533..2c63b896f 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -247,7 +247,7 @@ void multi_sink_example() { struct my_type { int i = 0; explicit my_type(int i) - : i(i){} + : i(i) {} }; #ifndef SPDLOG_USE_STD_FORMAT // when using fmtlib diff --git a/include/spdlog/common.h b/include/spdlog/common.h index 13981eaaf..63d0fceb6 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -159,7 +159,7 @@ using atomic_level_t = std::atomic; constexpr auto levels_count = level_to_number(level::n_levels); constexpr std::array level_string_views{"trace", "debug", "info", "warning", - "error", "critical", "off"}; + "error", "critical", "off"}; constexpr std::array short_level_names{"T", "D", "I", "W", "E", "C", "O"}; [[nodiscard]] constexpr std::string_view to_string_view(spdlog::level lvl) noexcept { diff --git a/include/spdlog/logger.h b/include/spdlog/logger.h index 368c6ef02..dff17f4f7 100644 --- a/include/spdlog/logger.h +++ b/include/spdlog/logger.h @@ -15,25 +15,25 @@ // formatted data, and support for different format per sink. #include -#include #include +#include #include "./common.h" #include "./details/log_msg.h" #include "./sinks/sink.h" #ifndef SPDLOG_NO_EXCEPTIONS - #define SPDLOG_LOGGER_CATCH(location) \ - catch (const std::exception &ex) { \ - if (!location.empty()) { \ + #define SPDLOG_LOGGER_CATCH(location) \ + catch (const std::exception &ex) { \ + if (!location.empty()) { \ err_handler_(fmt_lib::format(SPDLOG_FMT_STRING("{} [{}({})]"), ex.what(), location.filename, location.line)); \ - } else { \ - err_handler_(ex.what()); \ - } \ - } \ - catch (...) { \ - err_handler_("Rethrowing unknown exception in logger"); \ - throw; \ + } else { \ + err_handler_(ex.what()); \ + } \ + } \ + catch (...) { \ + err_handler_("Rethrowing unknown exception in logger"); \ + throw; \ } #else #define SPDLOG_LOGGER_CATCH(location) diff --git a/include/spdlog/sinks/android_sink.h b/include/spdlog/sinks/android_sink.h index be6718749..e2d1607e3 100644 --- a/include/spdlog/sinks/android_sink.h +++ b/include/spdlog/sinks/android_sink.h @@ -15,9 +15,9 @@ #include "../details/fmt_helper.h" #include "../details/null_mutex.h" + #include "../details/os.h" #include "../details/synchronous_factory.h" #include "./base_sink.h" - #include "../details/os.h" #if !defined(SPDLOG_ANDROID_RETRIES) #define SPDLOG_ANDROID_RETRIES 2 diff --git a/include/spdlog/sinks/basic_file_sink.h b/include/spdlog/sinks/basic_file_sink.h index fa1e202a3..1ffb06048 100644 --- a/include/spdlog/sinks/basic_file_sink.h +++ b/include/spdlog/sinks/basic_file_sink.h @@ -40,17 +40,17 @@ using basic_file_sink_st = basic_file_sink; // template std::shared_ptr basic_logger_mt(const std::string &logger_name, - const filename_t &filename, - bool truncate = false, - const file_event_handlers &event_handlers = {}) { + const filename_t &filename, + bool truncate = false, + const file_event_handlers &event_handlers = {}) { return Factory::template create(logger_name, filename, truncate, event_handlers); } template std::shared_ptr basic_logger_st(const std::string &logger_name, - const filename_t &filename, - bool truncate = false, - const file_event_handlers &event_handlers = {}) { + const filename_t &filename, + bool truncate = false, + const file_event_handlers &event_handlers = {}) { return Factory::template create(logger_name, filename, truncate, event_handlers); } diff --git a/include/spdlog/sinks/callback_sink.h b/include/spdlog/sinks/callback_sink.h index 3aa89dee7..ad0ec8eee 100644 --- a/include/spdlog/sinks/callback_sink.h +++ b/include/spdlog/sinks/callback_sink.h @@ -27,7 +27,7 @@ class callback_sink final : public base_sink { protected: void sink_it_(const details::log_msg &msg) override { callback_(msg); } - void flush_() override{} + void flush_() override {} private: custom_log_callback callback_; diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 2e9dfde3e..e15a00da8 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -29,8 +29,8 @@ struct daily_filename_calculator { static filename_t calc_filename(const filename_t &filename, const tm &now_tm) { filename_t basename, ext; std::tie(basename, ext) = details::file_helper::split_by_extension(filename); - return fmt_lib::format(SPDLOG_FMT_STRING(SPDLOG_FILENAME_T("{}_{:04d}-{:02d}-{:02d}{}")), basename, now_tm.tm_year + 1900, now_tm.tm_mon + 1, - now_tm.tm_mday, ext); + return fmt_lib::format(SPDLOG_FMT_STRING(SPDLOG_FILENAME_T("{}_{:04d}-{:02d}-{:02d}{}")), basename, now_tm.tm_year + 1900, + now_tm.tm_mon + 1, now_tm.tm_mday, ext); } }; diff --git a/include/spdlog/sinks/syslog_sink.h b/include/spdlog/sinks/syslog_sink.h index fe4d1b524..cb7249347 100644 --- a/include/spdlog/sinks/syslog_sink.h +++ b/include/spdlog/sinks/syslog_sink.h @@ -6,10 +6,10 @@ #include #include #include +#include #include #include -#include namespace spdlog { namespace sinks { @@ -88,8 +88,8 @@ inline std::shared_ptr syslog_logger_mt(const std::string &logger_name, int syslog_option = 0, int syslog_facility = LOG_USER, bool enable_formatting = false) { - return Factory::template create(logger_name, syslog_ident, syslog_option, - syslog_facility, enable_formatting); + return Factory::template create(logger_name, syslog_ident, syslog_option, syslog_facility, + enable_formatting); } template @@ -98,7 +98,7 @@ inline std::shared_ptr syslog_logger_st(const std::string &logger_name, int syslog_option = 0, int syslog_facility = LOG_USER, bool enable_formatting = false) { - return Factory::template create(logger_name, syslog_ident, syslog_option, - syslog_facility, enable_formatting); + return Factory::template create(logger_name, syslog_ident, syslog_option, syslog_facility, + enable_formatting); } } // namespace spdlog diff --git a/include/spdlog/spdlog.h b/include/spdlog/spdlog.h index 2d2f651b3..199e58c3a 100644 --- a/include/spdlog/spdlog.h +++ b/include/spdlog/spdlog.h @@ -206,9 +206,8 @@ inline void critical(std::string_view msg) { log(level::critical, msg); } #ifndef SPDLOG_NO_SOURCE_LOC #define SPDLOG_LOGGER_CALL(logger, level, ...) \ (logger)->log(spdlog::source_loc{__FILE__, __LINE__, SPDLOG_FUNCTION}, level, __VA_ARGS__) - #else - #define SPDLOG_LOGGER_CALL(logger, level, ...) \ - (logger)->log(spdlog::source_loc{}, level, __VA_ARGS__) +#else + #define SPDLOG_LOGGER_CALL(logger, level, ...) (logger)->log(spdlog::source_loc{}, level, __VA_ARGS__) #endif #if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_TRACE diff --git a/tests/test_create_dir.cpp b/tests/test_create_dir.cpp index 3cfb5e193..9fe35d072 100644 --- a/tests/test_create_dir.cpp +++ b/tests/test_create_dir.cpp @@ -75,11 +75,11 @@ TEST_CASE("dir_name", "[create_dir]") { #ifdef _WIN32 -// -// test windows cases when drive letter is given e.g. C:\\some-folder -// -#include -#include + // + // test windows cases when drive letter is given e.g. C:\\some-folder + // + #include + #include std::string get_full_path(const std::string &relative_folder_path) { char full_path[MAX_PATH]; @@ -100,7 +100,7 @@ spdlog::filename_t::value_type find_non_existing_drive() { std::string root_path = std::string(1, drive) + ":\\"; UINT drive_type = GetDriveTypeA(root_path.c_str()); if (drive_type == DRIVE_NO_ROOT_DIR) { - return static_cast (drive); + return static_cast(drive); } } return '\0'; // No available drive found @@ -125,11 +125,10 @@ TEST_CASE("non_existing_drive", "[create_dir]") { spdlog::filename_t path; auto non_existing_drive = find_non_existing_drive(); - path += non_existing_drive ; + path += non_existing_drive; path += SPDLOG_FILENAME_T(":\\"); REQUIRE(create_dir(path) == false); path += SPDLOG_FILENAME_T("subdir"); REQUIRE(create_dir(path) == false); - } #endif // _WIN32 diff --git a/tests/test_no_source_location.cpp b/tests/test_no_source_location.cpp index 19b652a56..c6a950af9 100644 --- a/tests/test_no_source_location.cpp +++ b/tests/test_no_source_location.cpp @@ -1,5 +1,5 @@ #ifndef SPDLOG_NO_SOURCE_LOC -#define SPDLOG_NO_SOURCE_LOC + #define SPDLOG_NO_SOURCE_LOC #endif #include "includes.h" diff --git a/tests/test_sink.h b/tests/test_sink.h index fd787bd0b..2818b68d4 100644 --- a/tests/test_sink.h +++ b/tests/test_sink.h @@ -10,9 +10,9 @@ #include #include "spdlog/details/null_mutex.h" +#include "spdlog/details/os.h" #include "spdlog/fmt/fmt.h" #include "spdlog/sinks/base_sink.h" -#include "spdlog/details/os.h" namespace spdlog { namespace sinks { diff --git a/tests/test_source_location.cpp b/tests/test_source_location.cpp index c48200166..8161d858d 100644 --- a/tests/test_source_location.cpp +++ b/tests/test_source_location.cpp @@ -1,5 +1,5 @@ -#ifdef SPDLOG_NO_SOURCE_LOC -#undef SPDLOG_NO_SOURCE_LOC +#ifdef SPDLOG_NO_SOURCE_LOC + #undef SPDLOG_NO_SOURCE_LOC #endif #include "includes.h"