spdlog
Loading...
Searching...
No Matches
include
spdlog
details
synchronous_factory.h
Go to the documentation of this file.
1
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
2
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
3
4
#pragma once
5
6
#include "
registry.h
"
7
8
namespace
spdlog
{
9
10
// Default logger factory- creates synchronous loggers
11
class
logger;
12
13
struct
synchronous_factory
14
{
15
template
<
typename
Sink,
typename
... SinkArgs>
16
static
std::shared_ptr<spdlog::logger>
create
(
std::string
logger_name, SinkArgs &&...args)
17
{
18
auto
sink =
std::make_shared<Sink>
(
std::forward<SinkArgs>
(args)...);
19
auto
new_logger =
std::make_shared<spdlog::logger>
(std::move(logger_name), std::move(sink));
20
details::registry::instance
().
initialize_logger
(new_logger);
21
return
new_logger;
22
}
23
};
24
}
// namespace spdlog
std::string
spdlog::details::registry::instance
static registry & instance()
Definition
registry-inl.h:291
spdlog::details::registry::initialize_logger
void initialize_logger(std::shared_ptr< logger > new_logger)
Definition
registry-inl.h:60
std::make_shared
T make_shared(T... args)
spdlog
Definition
async.h:25
registry.h
std::shared_ptr
spdlog::synchronous_factory
Definition
synchronous_factory.h:14
spdlog::synchronous_factory::create
static std::shared_ptr< spdlog::logger > create(std::string logger_name, SinkArgs &&...args)
Definition
synchronous_factory.h:16
Generated by
1.9.8