mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 08:25:43 +08:00
astyle
This commit is contained in:
parent
8d25324444
commit
73b31e4d10
@ -19,7 +19,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
g2LogWorker g2log(argv[0], "logs");
|
||||
g2::initializeLogging(&g2log);
|
||||
|
||||
|
||||
|
||||
std::atomic<int > msg_counter {0};
|
||||
vector<thread> threads;
|
||||
|
@ -5,10 +5,10 @@
|
||||
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)
|
||||
LOG(INFO) << "g2log message # " << i << ": This is some text for your pleasure";
|
||||
|
||||
|
@ -6,13 +6,13 @@ 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);
|
||||
|
||||
logger->set_pattern("[%Y-%b-%d %T.%e]: %v");
|
||||
for(int i = 0 ; i < howmany; ++i)
|
||||
logger->info() << "spdlog message #" << i << ": This is some text for your pleasure";
|
||||
spd::stop();
|
||||
spd::stop();
|
||||
return 0;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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,22 +79,22 @@ 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);
|
||||
bench_mt(howmany, daily_mt, threads);
|
||||
bench(howmany, spdlog::create<null_sink_st>("null_mt"));
|
||||
|
||||
|
||||
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
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user