mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-26 15:39:03 +08:00
Fixed warnings and unused include map
This commit is contained in:
parent
f0b2db05b3
commit
71a3caa018
12
README.md
12
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
|
#### Logger with multi sinks - each with a different format and log level
|
||||||
```c++
|
```c++
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
|
||||||
|
|
||||||
#include "../common.h"
|
#include "../common.h"
|
||||||
#include "./periodic_worker.h"
|
#include "./periodic_worker.h"
|
||||||
@ -24,8 +23,6 @@ class thread_pool;
|
|||||||
|
|
||||||
class SPDLOG_API context {
|
class SPDLOG_API context {
|
||||||
public:
|
public:
|
||||||
using log_levels = std::unordered_map<std::string, level>;
|
|
||||||
|
|
||||||
static context &instance();
|
static context &instance();
|
||||||
context(const context &) = delete;
|
context(const context &) = delete;
|
||||||
context &operator=(const context &) = delete;
|
context &operator=(const context &) = delete;
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
|
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
|
||||||
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
#include "spdlog/common.h"
|
|
||||||
#include "spdlog/details/context.h"
|
#include "spdlog/details/context.h"
|
||||||
#include "spdlog/logger.h"
|
#include "spdlog/logger.h"
|
||||||
#include "spdlog/pattern_formatter.h"
|
|
||||||
|
|
||||||
#ifndef SPDLOG_DISABLE_GLOBAL_LOGGER
|
#ifndef SPDLOG_DISABLE_GLOBAL_LOGGER
|
||||||
// support for the global stdout color logger
|
// support for the global stdout color logger
|
||||||
@ -18,10 +16,6 @@
|
|||||||
#endif // SPDLOG_DISABLE_GLOBAL_LOGGER
|
#endif // SPDLOG_DISABLE_GLOBAL_LOGGER
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
|
||||||
#include <unordered_map>
|
|
||||||
|
|
||||||
static constexpr size_t small_map_threshold = 10;
|
|
||||||
|
|
||||||
namespace spdlog {
|
namespace spdlog {
|
||||||
namespace details {
|
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.
|
// 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(); }
|
logger *context::global_logger_raw() const noexcept{ return global_logger_.get(); }
|
||||||
|
|
||||||
// set global logger.
|
// set global logger
|
||||||
// global logger is stored in global_logger_ (for faster retrieval) and in the loggers_ map.
|
|
||||||
void context::set_logger(std::shared_ptr<logger> new_global_logger) {
|
void context::set_logger(std::shared_ptr<logger> new_global_logger) {
|
||||||
global_logger_ = std::move(new_global_logger);
|
global_logger_ = std::move(new_global_logger);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user