From 17caf77784dc8266732a95171c8ab55c109b7aee Mon Sep 17 00:00:00 2001 From: Daniel Chabrowski Date: Sun, 25 Feb 2018 12:12:34 +0100 Subject: [PATCH] google-build-namespaces --- include/spdlog/details/os.h | 4 ++-- include/spdlog/details/pattern_formatter_impl.h | 4 ---- tests/file_helper.cpp | 13 ++----------- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/include/spdlog/details/os.h b/include/spdlog/details/os.h index 7f8d524f..eea83013 100644 --- a/include/spdlog/details/os.h +++ b/include/spdlog/details/os.h @@ -317,9 +317,9 @@ inline int utc_minutes_offset(const std::tm& tm = details::os::localtime()) } }; - long int offset_seconds = helper::calculate_gmt_offset(tm); + auto offset_seconds = helper::calculate_gmt_offset(tm); #else - long int offset_seconds = tm.tm_gmtoff; + auto offset_seconds = tm.tm_gmtoff; #endif return static_cast(offset_seconds / 60); diff --git a/include/spdlog/details/pattern_formatter_impl.h b/include/spdlog/details/pattern_formatter_impl.h index 32e7d60d..53c96119 100644 --- a/include/spdlog/details/pattern_formatter_impl.h +++ b/include/spdlog/details/pattern_formatter_impl.h @@ -34,8 +34,6 @@ public: /////////////////////////////////////////////////////////////////////// // name & level pattern appenders /////////////////////////////////////////////////////////////////////// -namespace -{ class name_formatter : public flag_formatter { void format(details::log_msg& msg, const std::tm&) override @@ -43,7 +41,6 @@ class name_formatter : public flag_formatter msg.formatted << *msg.logger_name; } }; -} // log level appender class level_formatter : public flag_formatter @@ -344,7 +341,6 @@ private: int get_cached_offset(const log_msg& msg, const std::tm& tm_time) { - using namespace std::chrono; std::lock_guard l(_mutex); if (msg.time - _last_update >= cache_refresh) { diff --git a/tests/file_helper.cpp b/tests/file_helper.cpp index d127c8f0..f57397eb 100644 --- a/tests/file_helper.cpp +++ b/tests/file_helper.cpp @@ -3,7 +3,8 @@ */ #include "includes.h" -using namespace spdlog::details; +using spdlog::details::log_msg; +using spdlog::details::file_helper; static const std::string target_filename = "logs/file_helper_test.txt"; @@ -15,7 +16,6 @@ static void write_with_helper(file_helper &helper, size_t howmany) helper.flush(); } - TEST_CASE("file_helper_filename", "[file_helper::filename()]]") { prepare_logdir(); @@ -25,8 +25,6 @@ TEST_CASE("file_helper_filename", "[file_helper::filename()]]") REQUIRE(helper.filename() == target_filename); } - - TEST_CASE("file_helper_size", "[file_helper::size()]]") { prepare_logdir(); @@ -40,7 +38,6 @@ TEST_CASE("file_helper_size", "[file_helper::size()]]") REQUIRE(get_filesize(target_filename) == expected_size); } - TEST_CASE("file_helper_exists", "[file_helper::file_exists()]]") { prepare_logdir(); @@ -73,8 +70,6 @@ TEST_CASE("file_helper_reopen2", "[file_helper::reopen(false)]]") REQUIRE(helper.size() == expected_size); } - - static void test_split_ext(const char* fname, const char* expect_base, const char* expect_ext) { spdlog::filename_t filename(fname); @@ -91,7 +86,6 @@ static void test_split_ext(const char* fname, const char* expect_base, const cha REQUIRE(ext == expected_ext); } - TEST_CASE("file_helper_split_by_extenstion", "[file_helper::split_by_extenstion()]]") { test_split_ext("mylog.txt", "mylog", ".txt"); @@ -113,6 +107,3 @@ TEST_CASE("file_helper_split_by_extenstion", "[file_helper::split_by_extenstion( test_split_ext(".", ".", ""); test_split_ext("..txt", ".", ".txt"); } - - -