OGLplus  (0.59.0) a C++ wrapper for rendering APIs

proxy_backend.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_LOGGING_PROXY_BACKEND_HPP
10 #define EAGINE_LOGGING_PROXY_BACKEND_HPP
11 
12 #include "backend.hpp"
13 #include <functional>
14 #include <vector>
15 
16 namespace eagine {
17 //------------------------------------------------------------------------------
18 class proxy_log_backend : public logger_backend {
19 public:
20  proxy_log_backend(log_event_severity min_severity) noexcept
21  : _min_severity{min_severity} {}
22 
23  auto configure(application_config&) -> bool final;
24 
25  auto entry_backend(identifier source, log_event_severity severity) noexcept
26  -> logger_backend* final;
27 
28  auto allocator() noexcept -> memory::shared_byte_allocator final;
29  auto type_id() noexcept -> identifier final;
30 
31  void enter_scope(identifier source) noexcept final;
32  void leave_scope(identifier source) noexcept final;
33 
34  void set_description(
35  identifier source,
36  logger_instance_id instance,
37  string_view name,
38  string_view desc) noexcept final;
39 
40  auto begin_message(
41  identifier source,
42  identifier tag,
43  logger_instance_id instance,
44  log_event_severity severity,
45  string_view format) noexcept -> bool final;
46 
47  void add_nothing(identifier arg, identifier tag) noexcept final;
48 
49  void add_identifier(
50  identifier arg,
51  identifier tag,
52  identifier value) noexcept final;
53 
54  void add_message_id(
55  identifier arg,
56  identifier tag,
57  message_id value) noexcept final;
58 
59  void add_bool(identifier arg, identifier tag, bool value) noexcept final;
60 
61  void add_integer(
62  identifier arg,
63  identifier tag,
64  std::intmax_t value) noexcept final;
65 
66  void add_unsigned(
67  identifier arg,
68  identifier tag,
69  std::uintmax_t value) noexcept final;
70 
71  void add_float(identifier arg, identifier tag, float value) noexcept final;
72 
73  void add_float(
74  identifier arg,
75  identifier tag,
76  float min,
77  float value,
78  float max) noexcept final;
79 
80  void add_duration(
81  identifier arg,
82  identifier tag,
83  std::chrono::duration<float> value) noexcept final;
84 
85  void add_string(identifier arg, identifier tag, string_view value) noexcept
86  final;
87 
88  void add_blob(
89  identifier arg,
90  identifier tag,
91  memory::const_block value) noexcept final;
92 
93  void finish_message() noexcept final;
94 
95  void finish_log() noexcept final;
96 
97  void log_chart_sample(
98  identifier source,
99  logger_instance_id instance,
100  identifier series,
101  float value) noexcept final;
102 
103 private:
104  std::unique_ptr<logger_backend> _delegate;
105  std::unique_ptr<std::vector<std::function<void()>>> _delayed{
106  std::make_unique<std::vector<std::function<void()>>>()};
107  log_event_severity _min_severity;
108 };
109 //------------------------------------------------------------------------------
110 } // namespace eagine
111 
112 #if !EAGINE_LINK_LIBRARY || defined(EAGINE_IMPLEMENTING_LIBRARY)
113 #include <eagine/logging/proxy_backend.inl>
114 #endif
115 
116 #endif // EAGINE_LOGGING_PROXY_BACKEND_HPP
basic_string_span< const char > string_view
Alias for const string views.
Definition: string_span.hpp:116
Common code is placed in this namespace.
Definition: eagine.hpp:21
std::uintptr_t logger_instance_id
Logger object instance id type.
Definition: backend.hpp:56
basic_block< true > const_block
Alias for const byte memory span.
Definition: block.hpp:32
static auto format(std::string &&fmt_str) noexcept -> format_string_and_list< 0 >
Function taking a format string, returning an object for variable specification.
Definition: str_format.hpp:118
log_event_severity
Log event severity enumeration.
Definition: severity.hpp:18
basic_identifier< 10, 6, default_identifier_char_set, identifier_t > identifier
Default identifier type used throughout the project.
Definition: identifier.hpp:346

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).