google-build-namespaces

This commit is contained in:
Daniel Chabrowski 2018-02-25 12:12:34 +01:00
parent 0c94ce0039
commit 17caf77784
3 changed files with 4 additions and 17 deletions

View File

@ -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 #else
long int offset_seconds = tm.tm_gmtoff; auto offset_seconds = tm.tm_gmtoff;
#endif #endif
return static_cast<int>(offset_seconds / 60); return static_cast<int>(offset_seconds / 60);

View File

@ -34,8 +34,6 @@ public:
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// name & level pattern appenders // name & level pattern appenders
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
namespace
{
class name_formatter : public flag_formatter class name_formatter : public flag_formatter
{ {
void format(details::log_msg& msg, const std::tm&) override 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; msg.formatted << *msg.logger_name;
} }
}; };
}
// log level appender // log level appender
class level_formatter : public flag_formatter class level_formatter : public flag_formatter
@ -344,7 +341,6 @@ private:
int get_cached_offset(const log_msg& msg, const std::tm& tm_time) int get_cached_offset(const log_msg& msg, const std::tm& tm_time)
{ {
using namespace std::chrono;
std::lock_guard<std::mutex> l(_mutex); std::lock_guard<std::mutex> l(_mutex);
if (msg.time - _last_update >= cache_refresh) if (msg.time - _last_update >= cache_refresh)
{ {

View File

@ -3,7 +3,8 @@
*/ */
#include "includes.h" #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"; 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(); helper.flush();
} }
TEST_CASE("file_helper_filename", "[file_helper::filename()]]") TEST_CASE("file_helper_filename", "[file_helper::filename()]]")
{ {
prepare_logdir(); prepare_logdir();
@ -25,8 +25,6 @@ TEST_CASE("file_helper_filename", "[file_helper::filename()]]")
REQUIRE(helper.filename() == target_filename); REQUIRE(helper.filename() == target_filename);
} }
TEST_CASE("file_helper_size", "[file_helper::size()]]") TEST_CASE("file_helper_size", "[file_helper::size()]]")
{ {
prepare_logdir(); prepare_logdir();
@ -40,7 +38,6 @@ TEST_CASE("file_helper_size", "[file_helper::size()]]")
REQUIRE(get_filesize(target_filename) == expected_size); REQUIRE(get_filesize(target_filename) == expected_size);
} }
TEST_CASE("file_helper_exists", "[file_helper::file_exists()]]") TEST_CASE("file_helper_exists", "[file_helper::file_exists()]]")
{ {
prepare_logdir(); prepare_logdir();
@ -73,8 +70,6 @@ TEST_CASE("file_helper_reopen2", "[file_helper::reopen(false)]]")
REQUIRE(helper.size() == expected_size); REQUIRE(helper.size() == expected_size);
} }
static void test_split_ext(const char* fname, const char* expect_base, const char* expect_ext) static void test_split_ext(const char* fname, const char* expect_base, const char* expect_ext)
{ {
spdlog::filename_t filename(fname); 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); REQUIRE(ext == expected_ext);
} }
TEST_CASE("file_helper_split_by_extenstion", "[file_helper::split_by_extenstion()]]") TEST_CASE("file_helper_split_by_extenstion", "[file_helper::split_by_extenstion()]]")
{ {
test_split_ext("mylog.txt", "mylog", ".txt"); 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(".", ".", "");
test_split_ext("..txt", ".", ".txt"); test_split_ext("..txt", ".", ".txt");
} }