spdlog
Loading...
Searching...
No Matches
include
spdlog
sinks
null_sink.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 <
spdlog/details/null_mutex.h
>
7
#include <
spdlog/sinks/base_sink.h
>
8
#include <
spdlog/details/synchronous_factory.h
>
9
10
#include <
mutex
>
11
12
namespace
spdlog
{
13
namespace
sinks {
14
15
template
<
typename
Mutex>
16
class
null_sink
:
public
base_sink
<Mutex>
17
{
18
protected
:
19
void
sink_it_
(
const
details::log_msg
&)
override
{}
20
void
flush_
()
override
{}
21
};
22
23
using
null_sink_mt
=
null_sink<details::null_mutex>
;
24
using
null_sink_st
=
null_sink<details::null_mutex>
;
25
26
}
// namespace sinks
27
28
template
<
typename
Factory = spdlog::synchronous_factory>
29
inline
std::shared_ptr<logger>
null_logger_mt
(
const
std::string
&logger_name)
30
{
31
auto
null_logger = Factory::template create<sinks::null_sink_mt>(logger_name);
32
null_logger->set_level(
level::off
);
33
return
null_logger;
34
}
35
36
template
<
typename
Factory = spdlog::synchronous_factory>
37
inline
std::shared_ptr<logger>
null_logger_st
(
const
std::string
&logger_name)
38
{
39
auto
null_logger = Factory::template create<sinks::null_sink_st>(logger_name);
40
null_logger->set_level(
level::off
);
41
return
null_logger;
42
}
43
44
}
// namespace spdlog
base_sink.h
std::string
spdlog::sinks::base_sink
Definition
base_sink.h:20
spdlog::sinks::null_sink
Definition
null_sink.h:17
spdlog::sinks::null_sink::flush_
void flush_() override
Definition
null_sink.h:20
spdlog::sinks::null_sink::sink_it_
void sink_it_(const details::log_msg &) override
Definition
null_sink.h:19
mutex
spdlog::level::off
@ off
Definition
common.h:169
spdlog
Definition
async.h:25
spdlog::null_logger_st
std::shared_ptr< logger > null_logger_st(const std::string &logger_name)
Definition
null_sink.h:37
spdlog::null_logger_mt
std::shared_ptr< logger > null_logger_mt(const std::string &logger_name)
Definition
null_sink.h:29
null_mutex.h
std::shared_ptr
spdlog::details::log_msg
Definition
log_msg.h:12
synchronous_factory.h
Generated by
1.9.8