From 71a3caa0186a7b49b194e25121a6fb0cbc95c0ac Mon Sep 17 00:00:00 2001 From: gabime Date: Fri, 6 Dec 2024 11:20:44 +0200 Subject: [PATCH] Fixed warnings and unused include map --- README.md | 12 ------------ include/spdlog/details/context.h | 3 --- src/details/context.cpp | 9 +-------- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/README.md b/README.md index f53ce7f2..31c845bb 100644 --- a/README.md +++ b/README.md @@ -195,18 +195,6 @@ void binary_example() ``` ---- -#### Mapped diagnostic context (MDC) -MDC is a map of contextual information that can be used to enrich log messages. -It is a map of key-value pairs that can be set on a per-thread basis since it is stored in thread-local storage. -```c++ -#include "spdlog/spdlog.h" -#include "spdlog/mdc" -... -spdlog::mdc::put("key1", "value1"); -spdlog::mdc::put("key2", "value2"); -``` - --- #### Logger with multi sinks - each with a different format and log level ```c++ diff --git a/include/spdlog/details/context.h b/include/spdlog/details/context.h index f92ecf0e..809418e0 100644 --- a/include/spdlog/details/context.h +++ b/include/spdlog/details/context.h @@ -11,7 +11,6 @@ #include #include #include -#include #include "../common.h" #include "./periodic_worker.h" @@ -24,8 +23,6 @@ class thread_pool; class SPDLOG_API context { public: - using log_levels = std::unordered_map; - static context &instance(); context(const context &) = delete; context &operator=(const context &) = delete; diff --git a/src/details/context.cpp b/src/details/context.cpp index 068a01ec..5cd6a22b 100644 --- a/src/details/context.cpp +++ b/src/details/context.cpp @@ -1,10 +1,8 @@ // Copyright(c) 2015-present, Gabi Melman & spdlog contributors. // Distributed under the MIT License (http://opensource.org/licenses/MIT) -#include "spdlog/common.h" #include "spdlog/details/context.h" #include "spdlog/logger.h" -#include "spdlog/pattern_formatter.h" #ifndef SPDLOG_DISABLE_GLOBAL_LOGGER // support for the global stdout color logger @@ -18,10 +16,6 @@ #endif // SPDLOG_DISABLE_GLOBAL_LOGGER #include -#include -#include - -static constexpr size_t small_map_threshold = 10; namespace spdlog { namespace details { @@ -52,8 +46,7 @@ std::shared_ptr context::global_logger() { // e.g do not call set_global_logger() from one thread while calling spdlog::info() from another. logger *context::global_logger_raw() const noexcept{ return global_logger_.get(); } -// set global logger. -// global logger is stored in global_logger_ (for faster retrieval) and in the loggers_ map. +// set global logger void context::set_logger(std::shared_ptr new_global_logger) { global_logger_ = std::move(new_global_logger); }