Flecs v4.0
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
20inline void set_level(int level) {
21 ecs_log_set_level(level);
22}
23
24inline int get_level() {
25 return ecs_log_get_level();
26}
27
29inline void enable_colors(bool enabled = true) {
30 ecs_log_enable_colors(enabled);
31}
32
34inline void enable_timestamp(bool enabled = true) {
36}
37
39inline void enable_timedelta(bool enabled = true) {
41}
42
44inline void dbg(const char *fmt, ...) {
45 va_list args;
46 va_start(args, fmt);
47 ecs_logv(1, fmt, args);
48 va_end(args);
49}
50
52inline void trace(const char *fmt, ...) {
53 va_list args;
54 va_start(args, fmt);
55 ecs_logv(0, fmt, args);
56 va_end(args);
57}
58
60inline void warn(const char *fmt, ...) {
61 va_list args;
62 va_start(args, fmt);
63 ecs_logv(-2, fmt, args);
64 va_end(args);
65}
66
68inline void err(const char *fmt, ...) {
69 va_list args;
70 va_start(args, fmt);
71 ecs_logv(-3, fmt, args);
72 va_end(args);
73}
74
76inline void push(const char *fmt, ...) {
77 va_list args;
78 va_start(args, fmt);
79 ecs_logv(0, fmt, args);
80 va_end(args);
81 ecs_log_push();
82}
83
85inline void push() {
86 ecs_log_push();
87}
88
90inline void pop() {
91 ecs_log_pop();
92}
93
96}
97}
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.
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:29
void enable_timedelta(bool enabled=true)
Enable time delta in logging.
Definition log.hpp:39
void push()
Increase log indentation.
Definition log.hpp:85
void set_level(int level)
Set log level.
Definition log.hpp:20
void trace(const char *fmt,...)
Trace (level 0)
Definition log.hpp:52
void err(const char *fmt,...)
Trace (level -3)
Definition log.hpp:68
void warn(const char *fmt,...)
Trace (level -2)
Definition log.hpp:60
void pop()
Increase log indentation.
Definition log.hpp:90
void enable_timestamp(bool enabled=true)
Enable timestamps in logging.
Definition log.hpp:34
void dbg(const char *fmt,...)
Debug trace (level 1)
Definition log.hpp:44