mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-28 17:19:34 +08:00
Format
This commit is contained in:
@@ -7,10 +7,10 @@
|
||||
// bench.cpp : spdlog benchmarks
|
||||
//
|
||||
#include "spdlog/async.h"
|
||||
#include "spdlog/sinks/simple_file_sink.h"
|
||||
#include "spdlog/sinks/daily_file_sink.h"
|
||||
#include "spdlog/sinks/rotating_file_sink.h"
|
||||
#include "spdlog/sinks/null_sink.h"
|
||||
#include "spdlog/sinks/rotating_file_sink.h"
|
||||
#include "spdlog/sinks/simple_file_sink.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
#include "utils.h"
|
||||
@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
|
||||
threads = atoi(argv[2]);
|
||||
if (argc > 3)
|
||||
queue_size = atoi(argv[3]);
|
||||
|
||||
|
||||
cout << "*******************************************************************************\n";
|
||||
cout << "Single thread, " << format(howmany) << " iterations" << endl;
|
||||
cout << "*******************************************************************************\n";
|
||||
|
@@ -10,9 +10,9 @@
|
||||
#define SPDLOG_TRACE_ON
|
||||
#define SPDLOG_DEBUG_ON
|
||||
|
||||
#include "spdlog/sinks/simple_file_sink.h"
|
||||
#include "spdlog/sinks/daily_file_sink.h"
|
||||
#include "spdlog/sinks/rotating_file_sink.h"
|
||||
#include "spdlog/sinks/simple_file_sink.h"
|
||||
#include "spdlog/sinks/stdout_color_sinks.h"
|
||||
|
||||
#include <iostream>
|
||||
@@ -61,13 +61,13 @@ int main(int, char *[])
|
||||
daily_logger->info(123.44);
|
||||
|
||||
// Customize msg format for all messages
|
||||
spd::set_pattern("[%^+++%$] [%H:%M:%S %z] [thread %t] %v");
|
||||
spd::set_pattern("[%^+++%$] [%H:%M:%S %z] [thread %t] %v");
|
||||
|
||||
console->info("This an info message with custom format");
|
||||
console->error("This an error message with custom format");
|
||||
|
||||
// Change format back to to default
|
||||
spd::set_pattern ("%+");
|
||||
// Change format back to to default
|
||||
spd::set_pattern("%+");
|
||||
|
||||
// Runtime log levels
|
||||
spd::set_level(spd::level::info); // Set global log level to info
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "spdlog/sinks/file_sinks.h"
|
||||
#include "spdlog/sinks/stdout_sinks.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
|
Reference in New Issue
Block a user