Malloy
Toggle main menu visibility
Loading...
Searching...
No Matches
lib
malloy
server
http
connection_t.hpp
1
#pragma once
2
3
#include <spdlog/logger.h>
4
5
#include <variant>
6
#include <memory>
7
8
namespace
malloy::server::http
9
{
10
class
connection_plain
;
11
12
#if MALLOY_FEATURE_TLS
13
class
connection_tls
;
14
#endif
15
19
using
connection_t = std::variant<
20
std::shared_ptr<connection_plain>
21
#if MALLOY_FEATURE_TLS
22
,std::shared_ptr<connection_tls>
23
#endif
24
>;
25
26
}
27
28
namespace
malloy
29
{
30
42
// ToDo: Move fmt in lambda capture?
43
// ToDo: Move args in lambda capture?
44
template
<
typename
...Args>
45
void
46
log
(
47
const
server::http::connection_t& conn,
48
spdlog::level::level_enum level,
49
fmt::format_string<Args...> fmt,
50
Args&&... args
51
)
52
{
53
std::visit(
54
[level, &fmt, ...args = std::forward<Args>(args)](
const
auto
& c)
mutable
{
55
if
(!c)
56
return
;
57
58
if
(c->logger())
59
c->logger()->log(level, fmt, std::forward<Args>(args)...);
60
},
61
conn
62
);
63
}
64
65
}
// namespace malloy
malloy::server::http::connection_plain
Definition
connection_plain.hpp:15
malloy::server::http::connection_tls
Definition
connection_tls.hpp:17
malloy
Definition
controller.hpp:32
malloy::log
void log(const server::http::connection_t &conn, spdlog::level::level_enum level, fmt::format_string< Args... > fmt, Args &&... args)
Definition
connection_t.hpp:46
Generated by
1.18.0