IceShard
1
A personal game engine project, with development focused on 2D/2.5D games.
Toggle main menu visibility
Loading...
Searching...
No Matches
logger
public
ice
log.hxx
Go to the documentation of this file.
1
3
4
#pragma once
5
#include <
ice/i18n_string.hxx
>
6
#include <
ice/log_formatters.hxx
>
7
#include <
ice/log_severity.hxx
>
8
#include <
ice/log_tag.hxx
>
9
#include <
ice/profiler.hxx
>
10
11
namespace
ice::detail
12
{
13
14
struct
LogLocation
15
{
16
ice::String
file
;
17
ice::u32
line
;
18
};
19
20
void
log
(
21
ice::LogSeverity
severity,
22
ice::LogTag
tag,
23
ice::String
message,
24
fmt::format_args args,
25
ice::detail::LogLocation
location
26
)
noexcept
;
27
28
void
log
(
29
ice::LogSeverity
severity,
30
ice::LogTag
tag,
31
ice::I18NString
message,
32
fmt::format_args args,
33
ice::detail::LogLocation
location
34
)
noexcept
;
35
36
constexpr
auto
log_make_args
() noexcept
37
{
38
return
fmt::make_format_args();
39
}
40
41
template
<
typename
... Args>
42
constexpr
auto
log_make_args
(Args&&... args)
noexcept
43
{
44
return
fmt::make_format_args(args...);
45
}
46
47
}
// namespace ice::detail
48
49
#if defined ICE_LOG
50
#error "Found existing definition of 'ICE_LOG'! Please do not redefine this macro!"
51
#endif
52
53
#define ICE_LOG(severity, tag, format, ...) \
54
do{ \
55
if constexpr(severity <= ice::lowest_compiled_log_severity) \
56
{ \
57
ice::detail::log( \
58
severity, \
59
ice::detail::get_tag(tag), \
60
format, \
61
ice::detail::log_make_args(__VA_ARGS__), \
62
ice::detail::LogLocation{ .file = __FILE__, .line = __LINE__ } \
63
); \
64
} \
65
} while(false)
66
67
#define ICE_LOG_IF(enable_condition, severity, tag, format, ...) \
68
do{ \
69
if constexpr(severity <= ice::lowest_compiled_log_severity) \
70
{ \
71
if (bool(enable_condition) == true) \
72
{ \
73
ice::detail::log( \
74
severity, \
75
ice::detail::get_tag(tag), \
76
format, \
77
ice::detail::log_make_args(__VA_ARGS__), \
78
ice::detail::LogLocation{ .file = __FILE__, .line = __LINE__ } \
79
); \
80
} \
81
} \
82
} while(false)
83
84
#if IPT_ENABLED
85
86
#define IPT_LOG(severity, tag, format, ...) \
87
IPT_MESSAGE(format); \
88
ICE_LOG(severity, tag, format, __VA_ARGS__)
89
90
#define IPT_ZONE_LOG(severity, tag, format, ...) \
91
IPT_ZONE_SCOPED; \
92
IPT_MESSAGE(format); \
93
ICE_LOG(severity, tag, format, __VA_ARGS__)
94
95
#else
96
97
#define IPT_LOG(severity, tag, format, ...) \
98
ICE_LOG(severity, tag, format, __VA_ARGS__)
99
100
#define IPT_ZONE_LOG(severity, tag, format, ...) \
101
ICE_LOG(severity, tag, format, __VA_ARGS__)
102
103
#endif
i18n_string.hxx
log_formatters.hxx
log_severity.hxx
log_tag.hxx
ice::detail
Definition
hashmap_details.hxx:13
ice::detail::log
void log(ice::LogSeverity severity, ice::LogTag tag, ice::String message, fmt::format_args args, ice::detail::LogLocation location) noexcept
ice::detail::log_make_args
constexpr auto log_make_args() noexcept
Definition
log.hxx:36
ice::String
ice::BasicString< char > String
Definition
string.hxx:82
ice::LogSeverity
LogSeverity
Definition
log_severity.hxx:11
ice::LogTag
LogTag
Definition
log_tag.hxx:12
ice::u32
std::uint32_t u32
Definition
types.hxx:26
profiler.hxx
ice::I18NString
Definition
i18n_string.hxx:9
ice::detail::LogLocation
Definition
log.hxx:15
ice::detail::LogLocation::file
ice::String file
Definition
log.hxx:16
ice::detail::LogLocation::line
ice::u32 line
Definition
log.hxx:17
Generated by
1.18.0