Flecs: include/flecs/addons/cpp/log.hpp Source File
Description: A fast entity component system (ECS) for C & C++

| 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
20 inline 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
29 inline void enable_colors(bool enabled = true) {
30 ecs_log_enable_colors(enabled);
31}
32
34 inline void enable_timestamp(bool enabled = true) {
35 ecs_log_enable_timestamp(enabled);
36}
37
39 inline void enable_timedelta(bool enabled = true) {
40 ecs_log_enable_timedelta(enabled);
41}
42
44 inline 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
52 inline 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
60 inline 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
68 inline 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
76 inline 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
85 inline void push() {
86 ecs_log_push();
87}
88
90 inline void pop() {
91 ecs_log_pop();
92}
93
96}
97}
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_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:29
flecs::log::enable_timedelta
void enable_timedelta(bool enabled=true)
Enable time delta in logging.
Definition log.hpp:39
flecs::log::push
void push()
Increase log indentation.
Definition log.hpp:85
flecs::log::set_level
void set_level(int level)
Set log level.
Definition log.hpp:20
flecs::log::trace
void trace(const char *fmt,...)
Trace (level 0)
Definition log.hpp:52
flecs::log::err
void err(const char *fmt,...)
Trace (level -3)
Definition log.hpp:68
flecs::log::warn
void warn(const char *fmt,...)
Trace (level -2)
Definition log.hpp:60
flecs::log::pop
void pop()
Increase log indentation.
Definition log.hpp:90
flecs::log::enable_timestamp
void enable_timestamp(bool enabled=true)
Enable timestamps in logging.
Definition log.hpp:34
flecs::log::dbg
void dbg(const char *fmt,...)
Debug trace (level 1)
Definition log.hpp:44