mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-28 17:19:34 +08:00
@@ -269,7 +269,7 @@ void multi_sink_example() {
|
||||
struct my_type {
|
||||
int i = 0;
|
||||
explicit my_type(int i)
|
||||
: i(i){}
|
||||
: i(i) {}
|
||||
};
|
||||
|
||||
#ifndef SPDLOG_USE_STD_FORMAT // when using fmtlib
|
||||
@@ -382,14 +382,14 @@ void replace_default_logger_example() {
|
||||
spdlog::set_default_logger(old_logger);
|
||||
}
|
||||
|
||||
// Mapped Diagnostic Context (MDC) is a map that stores key-value pairs (string values) in thread local storage.
|
||||
// Each thread maintains its own MDC, which loggers use to append diagnostic information to log outputs.
|
||||
// Note: it is not supported in asynchronous mode due to its reliance on thread-local storage.
|
||||
// Mapped Diagnostic Context (MDC) is a map that stores key-value pairs (string values) in thread
|
||||
// local storage. Each thread maintains its own MDC, which loggers use to append diagnostic
|
||||
// information to log outputs. Note: it is not supported in asynchronous mode due to its reliance on
|
||||
// thread-local storage.
|
||||
|
||||
#ifndef SPDLOG_NO_TLS
|
||||
#include "spdlog/mdc.h"
|
||||
void mdc_example()
|
||||
{
|
||||
void mdc_example() {
|
||||
spdlog::mdc::put("key1", "value1");
|
||||
spdlog::mdc::put("key2", "value2");
|
||||
// if not using the default format, you can use the %& formatter to print mdc data as well
|
||||
|
Reference in New Issue
Block a user