Flecs v4.1
A fast entity component system (ECS) for C & C++
Loading...
Searching...
No Matches
log.hpp
Go to the documentation of this file.
1
6#pragma once
7
8namespace flecs {
9namespace log {
10
23inline void set_level(int level) {
24 ecs_log_set_level(level);
25}
26
31inline int get_level() {
32 return ecs_log_get_level();
33}
34
39inline void enable_colors(bool enabled = true) {
40 ecs_log_enable_colors(enabled);
41}
42
47inline void enable_timestamp(bool enabled = true) {
49}
50
55inline void enable_timedelta(bool enabled = true) {
57}
58
63inline 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
74inline 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
85inline 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
96inline 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
107inline 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
116inline void push() {
117 ecs_log_push();
118}
119
121inline void pop() {
122 ecs_log_pop();
123}
124
127}
128}
#define ecs_logv(level, fmt, args)
Log at the provided level with va_list.
Definition log.h:303
#define ecs_log_push()
Push log indentation at the default level.
Definition log.h:458
FLECS_API bool ecs_log_enable_colors(bool enabled)
Enable/disable tracing with colors.
FLECS_API int ecs_log_get_level(void)
Get current log level.
#define ecs_log_pop()
Pop log indentation at the default level.
Definition log.h:460
FLECS_API int ecs_log_set_level(int level)
Enable or disable log.
FLECS_API bool ecs_log_enable_timestamp(bool enabled)
Enable/disable logging timestamp.
FLECS_API bool ecs_log_enable_timedelta(bool enabled)
Enable/disable logging time since last log.
void enable_colors(bool enabled=true)
Enable colors in logging.
Definition log.hpp:39
void enable_timedelta(bool enabled=true)
Enable time delta in logging.
Definition log.hpp:55
void push()
Increase log indentation.
Definition log.hpp:116
void set_level(int level)
Set the log level.
Definition log.hpp:23
void trace(const char *fmt,...)
Trace (level 0).
Definition log.hpp:74
void err(const char *fmt,...)
Error (level -3).
Definition log.hpp:96
void warn(const char *fmt,...)
Warning (level -2).
Definition log.hpp:85
int get_level()
Get the log level.
Definition log.hpp:31
void pop()
Decrease log indentation.
Definition log.hpp:121
void enable_timestamp(bool enabled=true)
Enable timestamps in logging.
Definition log.hpp:47
void dbg(const char *fmt,...)
Debug trace (level 1).
Definition log.hpp:63