Fixed warnings and unused include map

This commit is contained in:
gabime 2024-12-06 11:20:44 +02:00
parent f0b2db05b3
commit 71a3caa018
3 changed files with 1 additions and 23 deletions

View File

@ -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++

View File

@ -11,7 +11,6 @@
#include <memory>
#include <mutex>
#include <string>
#include <unordered_map>
#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<std::string, level>;
static context &instance();
context(const context &) = delete;
context &operator=(const context &) = delete;

View File

@ -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 <memory>
#include <string>
#include <unordered_map>
static constexpr size_t small_map_threshold = 10;
namespace spdlog {
namespace details {
@ -52,8 +46,7 @@ std::shared_ptr<logger> 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<logger> new_global_logger) {
global_logger_ = std::move(new_global_logger);
}