mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 10:01:33 +08:00
platform eol
This commit is contained in:
parent
9d9a955e94
commit
08ba1791ba
@ -21,6 +21,7 @@ int main(int argc, char* argv[])
|
||||
if(argc || argv) {};
|
||||
|
||||
auto fsink = std::make_shared<sinks::rotating_file_sink>("log", "txt", 1024*1024*50 , 5, 0);
|
||||
//auto fsink = std::make_shared<sinks::simple_file_sink>("simplelog", "txt");
|
||||
auto null_sink = std::make_shared<sinks::null_sink>();
|
||||
|
||||
|
||||
@ -29,11 +30,11 @@ int main(int argc, char* argv[])
|
||||
cout_logger.info() << "Hello cout logger!";
|
||||
|
||||
|
||||
logger my_logger ("my_logger", {fsink});
|
||||
logger my_logger ("my_logger", {null_sink});
|
||||
|
||||
auto start = system_clock::now();
|
||||
|
||||
const unsigned int howmany = 15000000;
|
||||
const unsigned int howmany = 500000;
|
||||
for(unsigned int i = 0; i < howmany ; i++)
|
||||
my_logger.info() << "Hello logger " << i;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
CXX = g++
|
||||
CXXFLAGS = -march=native -Wall -Wextra -Wshadow -pedantic -std=c++11 -pthread -I../include
|
||||
CXX_RELEASE_FLAGS = -O3 -flto
|
||||
CXX_RELEASE_FLAGS = -O3 -flto -g
|
||||
CXX_DEBUG_FLAGS= -g
|
||||
|
||||
OUTBIN = example
|
||||
|
@ -49,14 +49,14 @@ public:
|
||||
{
|
||||
if (_enabled)
|
||||
{
|
||||
_oss << '\n';
|
||||
_oss << os::eol();
|
||||
_callback_logger->_log_it(_oss.str_ref(), _level);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename T>
|
||||
line_logger&& operator<<(const T& msg) &&
|
||||
line_logger&& operator<<(const T& msg)
|
||||
{
|
||||
if (_enabled)
|
||||
_oss << msg;
|
||||
|
@ -14,7 +14,7 @@ inline std::tm localtime(const std::time_t &time_tt)
|
||||
{
|
||||
|
||||
std::tm tm;
|
||||
#ifdef _MSC_VER
|
||||
#ifdef _WIN32
|
||||
localtime_s(&tm, &time_tt);
|
||||
#else
|
||||
localtime_r(&time_tt, &tm);
|
||||
@ -47,9 +47,17 @@ inline bool operator!=(const std::tm& tm1, const std::tm& tm2)
|
||||
return !(tm1==tm2);
|
||||
}
|
||||
|
||||
inline const char* eol()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return "\r\n";
|
||||
#else
|
||||
return "\n";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
} //os
|
||||
} //details
|
||||
} //c11log
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user