This commit is contained in:
gabime 2014-11-29 20:02:14 +02:00
parent 8d25324444
commit 73b31e4d10
8 changed files with 564 additions and 291 deletions

View File

@ -6,7 +6,7 @@ int main(int, char* argv[])
{
int howmany = 1000000;
g2LogWorker g2log(argv[0], "logs");
g2LogWorker g2log(argv[0], "logs");
g2::initializeLogging(&g2log);
for(int i = 0 ; i < howmany; ++i)

View File

@ -6,7 +6,7 @@ int main(int, char* [])
{
int howmany = 1000000;
namespace spd = spdlog;
spd::set_async_mode(2500, std::chrono::seconds(0));
spd::set_async_mode(2500, std::chrono::seconds(0));
///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);

View File

@ -17,7 +17,7 @@ int main(int argc, char* argv[])
int howmany = 1000000;
namespace spd = spdlog;
spd::set_async_mode(2500, std::chrono::seconds(0));
spd::set_async_mode(2500, std::chrono::seconds(0));
///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);
@ -45,6 +45,6 @@ int main(int argc, char* argv[])
t.join();
};
spd::stop();
spd::stop();
return 0;
}

View File

@ -52,7 +52,7 @@ int main(int argc, char* argv[])
int howmany = 1000000;
int threads = 10;
bool auto_flush = false;
bool auto_flush = false;
int file_size = 30 * 1024 * 1024;
int rotating_files = 5;
@ -79,7 +79,7 @@ int main(int argc, char* argv[])
cout << "*******************************************************************************\n";
auto rotating_mt = spdlog::rotating_logger_mt("rotating_mt", "logs/rotating_mt", file_size, rotating_files, auto_flush);
bench_mt(howmany, rotating_mt, threads);
bench_mt(howmany, rotating_mt, threads);
auto daily_mt = spdlog::daily_logger_mt("daily_mt", "logs/daily_mt", auto_flush);
@ -88,12 +88,12 @@ int main(int argc, char* argv[])
cout << "\n*******************************************************************************\n";
cout << "async logging.. " << threads << " threads sharing same logger, " << format(howmany) << " iterations, auto_flush=" << auto_flush << endl;
cout << "*******************************************************************************\n";
cout << "*******************************************************************************\n";
spdlog::set_async_mode(2500);
auto daily_st_async = spdlog::daily_logger_st("daily_async", "logs/daily_async", auto_flush);
bench_mt(howmany, daily_st_async, threads);
bench_mt(howmany, daily_st_async, threads);
spdlog::stop();

File diff suppressed because it is too large Load Diff

View File

@ -61,8 +61,10 @@ should not be interpreted as representing official policies, either expressed or
#include <atomic>
namespace spdlog {
namespace details {
namespace spdlog
{
namespace details
{
template<typename T>
class mpsc_q
{

View File

@ -429,7 +429,7 @@ inline void spdlog::pattern_formatter::handle_flag(char flag)
{
switch (flag)
{
// logger name
// logger name
case 'n':
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::name_formatter()));
break;