srs-control
0.2.2
Toggle main menu visibility
Loading...
Searching...
No Matches
ExitLogger.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include "
srs/utils/CommonDefinitions.hpp
"
4
#include <source_location>
5
#include <spdlog/spdlog.h>
6
#include <string_view>
7
8
namespace
srs
9
{
10
11
class
ExitLogger
12
{
13
public
:
14
explicit
ExitLogger
(std::string_view tag =
""
,
15
const
std::source_location& location = std::source_location::current())
16
:
function_name_
{ location.function_name() }
17
,
tag_
{ tag }
18
{
19
if
(
tag_
.empty())
20
{
21
tag_ = std::string_view{
"function"
};
22
}
23
spdlog::trace(
"{} {} ({})"
,
common::exit_logger_begin
,
function_name_
,
tag_
);
24
}
25
26
ExitLogger
(
const
ExitLogger
&) =
default
;
27
ExitLogger
(
ExitLogger
&&) =
delete
;
28
ExitLogger
&
operator=
(
const
ExitLogger
&) =
default
;
29
ExitLogger
&
operator=
(
ExitLogger
&&) =
delete
;
30
~ExitLogger
() { spdlog::trace(
"{} {} ({})"
,
common::exit_logger_end
,
function_name_
,
tag_
); }
31
32
private
:
33
std::string_view
function_name_
;
34
std::string_view
tag_
;
35
};
36
37
}
// namespace srs
CommonDefinitions.hpp
srs::ExitLogger::tag_
std::string_view tag_
Definition
ExitLogger.hpp:34
srs::ExitLogger::ExitLogger
ExitLogger(std::string_view tag="", const std::source_location &location=std::source_location::current())
Definition
ExitLogger.hpp:14
srs::ExitLogger::operator=
ExitLogger & operator=(ExitLogger &&)=delete
srs::ExitLogger::function_name_
std::string_view function_name_
Definition
ExitLogger.hpp:33
srs::ExitLogger::~ExitLogger
~ExitLogger()
Definition
ExitLogger.hpp:30
srs::ExitLogger::operator=
ExitLogger & operator=(const ExitLogger &)=default
srs::ExitLogger::ExitLogger
ExitLogger(const ExitLogger &)=default
srs::ExitLogger::ExitLogger
ExitLogger(ExitLogger &&)=delete
srs::common::exit_logger_begin
constexpr auto exit_logger_begin
Definition
CommonDefinitions.hpp:61
srs::common::exit_logger_end
constexpr auto exit_logger_end
Definition
CommonDefinitions.hpp:62
srs
Definition
Application.cpp:45
backend
srs
utils
ExitLogger.hpp
Impressum
Datenschutzerklärung
Generated by
1.17.0