Ported pull #3023 with some changes and tests

This commit is contained in:
gabime
2024-03-16 17:12:46 +02:00
parent 167bf989d8
commit 8e10782a58
5 changed files with 223 additions and 175 deletions

View File

@@ -14,6 +14,7 @@
#include <memory>
#include <mutex>
#include <string>
#include <string_view>
#include "./common.h"
#include "./details/registry.h"
@@ -50,6 +51,8 @@ SPDLOG_API void initialize_logger(std::shared_ptr<logger> logger);
// exist.
// example: spdlog::get("my_logger")->info("hello {}", "world");
SPDLOG_API std::shared_ptr<logger> get(const std::string &name);
SPDLOG_API std::shared_ptr<logger> get(std::string_view name);
SPDLOG_API std::shared_ptr<logger> get(const char *name);
// Set global formatter. Each sink in each logger will get a clone of this object
SPDLOG_API void set_formatter(std::unique_ptr<spdlog::formatter> formatter);