Flecs
v4.1
A fast entity component system (ECS) for C & C++
Toggle main menu visibility
Loading...
Searching...
No Matches
log.hpp
Go to the documentation of this file.
1
5
6
#pragma once
7
8
namespace
flecs {
9
namespace
log {
10
18
23
inline
void
set_level
(
int
level) {
24
ecs_log_set_level
(level);
25
}
26
31
inline
int
get_level
() {
32
return
ecs_log_get_level
();
33
}
34
39
inline
void
enable_colors
(
bool
enabled =
true
) {
40
ecs_log_enable_colors
(enabled);
41
}
42
47
inline
void
enable_timestamp
(
bool
enabled =
true
) {
48
ecs_log_enable_timestamp
(enabled);
49
}
50
55
inline
void
enable_timedelta
(
bool
enabled =
true
) {
56
ecs_log_enable_timedelta
(enabled);
57
}
58
63
inline
void
dbg
(
const
char
*fmt, ...) {
64
va_list args;
65
va_start(args, fmt);
66
ecs_logv
(1, fmt, args);
67
va_end(args);
68
}
69
74
inline
void
trace
(
const
char
*fmt, ...) {
75
va_list args;
76
va_start(args, fmt);
77
ecs_logv
(0, fmt, args);
78
va_end(args);
79
}
80
85
inline
void
warn
(
const
char
*fmt, ...) {
86
va_list args;
87
va_start(args, fmt);
88
ecs_logv
(-2, fmt, args);
89
va_end(args);
90
}
91
96
inline
void
err
(
const
char
*fmt, ...) {
97
va_list args;
98
va_start(args, fmt);
99
ecs_logv
(-3, fmt, args);
100
va_end(args);
101
}
102
107
inline
void
push
(
const
char
*fmt, ...) {
108
va_list args;
109
va_start(args, fmt);
110
ecs_logv
(0, fmt, args);
111
va_end(args);
112
ecs_log_push
();
113
}
114
116
inline
void
push
() {
117
ecs_log_push
();
118
}
119
121
inline
void
pop
() {
122
ecs_log_pop
();
123
}
124
126
127
}
128
}
ecs_logv
#define ecs_logv(level, fmt, args)
Log at the provided level with va_list.
Definition
log.h:303
ecs_log_push
#define ecs_log_push()
Push log indentation at the default level.
Definition
log.h:458
ecs_log_enable_colors
FLECS_API bool ecs_log_enable_colors(bool enabled)
Enable/disable tracing with colors.
ecs_log_get_level
FLECS_API int ecs_log_get_level(void)
Get current log level.
ecs_log_pop
#define ecs_log_pop()
Pop log indentation at the default level.
Definition
log.h:460
ecs_log_set_level
FLECS_API int ecs_log_set_level(int level)
Enable or disable log.
ecs_log_enable_timestamp
FLECS_API bool ecs_log_enable_timestamp(bool enabled)
Enable/disable logging timestamp.
ecs_log_enable_timedelta
FLECS_API bool ecs_log_enable_timedelta(bool enabled)
Enable/disable logging time since last log.
flecs::log::enable_colors
void enable_colors(bool enabled=true)
Enable colors in logging.
Definition
log.hpp:39
flecs::log::enable_timedelta
void enable_timedelta(bool enabled=true)
Enable time delta in logging.
Definition
log.hpp:55
flecs::log::push
void push()
Increase log indentation.
Definition
log.hpp:116
flecs::log::set_level
void set_level(int level)
Set the log level.
Definition
log.hpp:23
flecs::log::trace
void trace(const char *fmt,...)
Trace (level 0).
Definition
log.hpp:74
flecs::log::err
void err(const char *fmt,...)
Error (level -3).
Definition
log.hpp:96
flecs::log::warn
void warn(const char *fmt,...)
Warning (level -2).
Definition
log.hpp:85
flecs::log::get_level
int get_level()
Get the log level.
Definition
log.hpp:31
flecs::log::pop
void pop()
Decrease log indentation.
Definition
log.hpp:121
flecs::log::enable_timestamp
void enable_timestamp(bool enabled=true)
Enable timestamps in logging.
Definition
log.hpp:47
flecs::log::dbg
void dbg(const char *fmt,...)
Debug trace (level 1).
Definition
log.hpp:63