Go to the documentation of this file.
9 #ifndef EAGINE_LOGGING_BACKEND_HPP
10 #define EAGINE_LOGGING_BACKEND_HPP
12 #include "../interface.hpp"
13 #include "../memory/block.hpp"
14 #include "../memory/shared_alloc.hpp"
15 #include "../message_id.hpp"
16 #include "../string_span.hpp"
22 class application_config;
32 adapt_log_entry_arg(std::declval<identifier>(), std::declval<X>()))>
33 static auto _test(X*) -> std::true_type;
34 static auto _test(...) -> std::false_type;
38 using type = decltype(_test(
static_cast<T*
>(
nullptr)));
66 virtual auto allocator() noexcept -> memory::shared_byte_allocator = 0;
136 std::intmax_t value) noexcept = 0;
145 std::uintmax_t value) noexcept = 0;
165 float max) noexcept = 0;
174 std::chrono::duration<float> value) noexcept = 0;
197 template <
typename T>
199 -> std::enable_if_t<has_log_entry_adapter_v<T>> {
200 adapt_log_entry_arg(arg, value)(*this);
218 float value) noexcept = 0;
223 #endif // EAGINE_LOGGING_BACKEND_HPP
auto add_adapted(identifier arg, const T &value) -> std::enable_if_t< has_log_entry_adapter_v< T >>
Add argument with value having type adaptable to log entry.
Definition: backend.hpp:198
virtual void add_string(identifier arg, identifier tag, string_view value) noexcept=0
Add argument with string value.
Helper class used in implementation of has_log_entry_adapter_t.
Definition: backend.hpp:27
Common code is placed in this namespace.
Definition: eagine.hpp:21
virtual void finish_message() noexcept=0
Finishes the current logging message.
std::uintptr_t logger_instance_id
Logger object instance id type.
Definition: backend.hpp:56
Class for reading application configuration.
Definition: application_config.hpp:29
typename does_have_log_entry_adapter< T >::type has_log_entry_adapter_t
Trait indicating if there is a log entry adapter for type T.
Definition: backend.hpp:45
virtual void add_bool(identifier arg, identifier tag, bool value) noexcept=0
Add argument with boolean value.
virtual void leave_scope(identifier scope) noexcept=0
Leaves logging scope.
virtual void add_duration(identifier arg, identifier tag, std::chrono::duration< float > value) noexcept=0
Add argument with time duration value.
virtual void set_description(identifier source, logger_instance_id instance, string_view display_name, string_view description) noexcept=0
Sets the user-readable description for the logger object.
Base template for abstract interfaces, implements common functionality.
Definition: interface.hpp:18
virtual void finish_log() noexcept=0
Finishes the current log.
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
virtual auto allocator() noexcept -> memory::shared_byte_allocator=0
The memory allocator used by the logger backend.
Non-owning view of a contiguous range of memory with ValueType elements.
Definition: flatten_fwd.hpp:16
virtual void add_identifier(identifier arg, identifier tag, identifier value) noexcept=0
Add argument with identifier value.
log_event_severity
Log event severity enumeration.
Definition: severity.hpp:18
virtual void add_blob(identifier arg, identifier tag, memory::const_block value) noexcept=0
Add argument with BLOB value.
Interface for logging backend implementations.
Definition: backend.hpp:60
virtual void add_unsigned(identifier arg, identifier tag, std::uintmax_t value) noexcept=0
Add argument with unsigned integer value.
Class storing two identifier values representing class/method pair.
Definition: message_id.hpp:25
virtual void log_chart_sample(identifier source, logger_instance_id instance, identifier series, float value) noexcept=0
Adds a chart/graph sample to the log.
virtual void add_float(identifier arg, identifier tag, float value) noexcept=0
Add argument with floating-point value.
virtual void enter_scope(identifier scope) noexcept=0
Enters logging scope.
virtual void add_integer(identifier arg, identifier tag, std::intmax_t value) noexcept=0
Add argument with signed integer value.
virtual auto begin_message(identifier source, identifier tag, logger_instance_id instance, log_event_severity severity, string_view format) noexcept -> bool=0
Begins a new logging message.
virtual void add_nothing(identifier arg, identifier tag) noexcept=0
Add valueless (name-only) argument.
constexpr const bool has_log_entry_adapter_v
Trait indicating if there is a log entry adapter for type T.
Definition: backend.hpp:51
virtual auto entry_backend(identifier source, log_event_severity severity) noexcept -> logger_backend *=0
Returns a pointer to the actual backend to be used by an log_entry.
virtual auto type_id() noexcept -> identifier=0
The backend type identifier.