mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-26 15:39:03 +08:00
astyle
This commit is contained in:
parent
db633b8c53
commit
8b51b3b277
@ -38,11 +38,11 @@ using namespace std;
|
|||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int thread_count = 10;
|
int thread_count = 10;
|
||||||
if(argc > 1)
|
if(argc > 1)
|
||||||
thread_count = atoi(argv[1]);
|
thread_count = atoi(argv[1]);
|
||||||
|
|
||||||
int howmany = 1000000;
|
int howmany = 1000000;
|
||||||
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
@ -64,7 +64,7 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
int counter = ++msg_counter;
|
int counter = ++msg_counter;
|
||||||
if (counter > howmany) break;
|
if (counter > howmany) break;
|
||||||
BOOST_LOG_SEV(lg, info) << "Boost logger message #" << counter;
|
BOOST_LOG_SEV(lg, info) << "Boost logger message #" << counter;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -32,14 +32,14 @@ void init()
|
|||||||
|
|
||||||
int main(int argc, char* [])
|
int main(int argc, char* [])
|
||||||
{
|
{
|
||||||
int howmany = 1000000;
|
int howmany = 1000000;
|
||||||
init();
|
init();
|
||||||
logging::add_common_attributes();
|
logging::add_common_attributes();
|
||||||
|
|
||||||
using namespace logging::trivial;
|
using namespace logging::trivial;
|
||||||
src::severity_logger_mt< severity_level > lg;
|
src::severity_logger_mt< severity_level > lg;
|
||||||
for(int i = 0 ; i < howmany; ++i)
|
for(int i = 0 ; i < howmany; ++i)
|
||||||
BOOST_LOG_SEV(lg, info) << "Boost logger message #" << i;
|
BOOST_LOG_SEV(lg, info) << "Boost logger message #" << i;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -10,22 +10,22 @@ using namespace std;
|
|||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
|
||||||
int thread_count = 10;
|
int thread_count = 10;
|
||||||
if(argc > 1)
|
if(argc > 1)
|
||||||
thread_count = atoi(argv[1]);
|
thread_count = atoi(argv[1]);
|
||||||
|
|
||||||
int howmany = 1000000;
|
int howmany = 1000000;
|
||||||
|
|
||||||
namespace spd = spdlog;
|
namespace spd = spdlog;
|
||||||
///Create a file rotating logger with 5mb size max and 3 rotated files
|
///Create a file rotating logger with 5mb size max and 3 rotated files
|
||||||
auto logger = spd::rotating_logger_mt("file_logger", "logs/spd-sample", 10 *1024 * 1024 , 5);
|
auto logger = spd::rotating_logger_mt("file_logger", "logs/spd-sample", 10 *1024 * 1024 , 5);
|
||||||
|
|
||||||
logger->set_pattern("[%Y-%b-%d %T.%e]: %v");
|
logger->set_pattern("[%Y-%b-%d %T.%e]: %v");
|
||||||
|
|
||||||
std::atomic<int > msg_counter {0};
|
std::atomic<int > msg_counter {0};
|
||||||
vector<thread> threads;
|
vector<thread> threads;
|
||||||
|
|
||||||
for (int t = 0; t < thread_count; ++t)
|
for (int t = 0; t < thread_count; ++t)
|
||||||
{
|
{
|
||||||
threads.push_back(std::thread([&]()
|
threads.push_back(std::thread([&]()
|
||||||
{
|
{
|
||||||
@ -33,7 +33,7 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
int counter = ++msg_counter;
|
int counter = ++msg_counter;
|
||||||
if (counter > howmany) break;
|
if (counter > howmany) break;
|
||||||
logger->info() << "spdlog logger message #" << counter;
|
logger->info() << "spdlog logger message #" << counter;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
|
|
||||||
int main(int argc, char* [])
|
int main(int argc, char* [])
|
||||||
{
|
{
|
||||||
int howmany = 1000000;
|
int howmany = 1000000;
|
||||||
namespace spd = spdlog;
|
namespace spd = spdlog;
|
||||||
///Create a file rotating logger with 5mb size max and 3 rotated files
|
///Create a file rotating logger with 5mb size max and 3 rotated files
|
||||||
auto logger = spd::rotating_logger_mt("file_logger", "logs/spd-sample", 10 *1024 * 1024 , 5);
|
auto logger = spd::rotating_logger_mt("file_logger", "logs/spd-sample", 10 *1024 * 1024 , 5);
|
||||||
|
|
||||||
logger->set_pattern("[%Y-%b-%d %T.%e]: %v");
|
logger->set_pattern("[%Y-%b-%d %T.%e]: %v");
|
||||||
for(int i = 0 ; i < howmany; ++i)
|
for(int i = 0 ; i < howmany; ++i)
|
||||||
logger->info() << "spdlogger message #" << i;
|
logger->info() << "spdlogger message #" << i;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -457,7 +457,7 @@ inline void spdlog::pattern_formatter::handle_flag(char flag)
|
|||||||
{
|
{
|
||||||
switch (flag)
|
switch (flag)
|
||||||
{
|
{
|
||||||
// logger name
|
// logger name
|
||||||
case 'n':
|
case 'n':
|
||||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::name_formatter()));
|
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::name_formatter()));
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user