Log addon

Functions

_ecs_abort
_ecs_assert
_ecs_deprecated
_ecs_log
_ecs_logv
_ecs_parser_error
_ecs_parser_errorv
ecs_log_enable_colorsEnable/disable tracing with colors
ecs_log_last_errorGet last logged error code
ecs_log_pop
ecs_log_push
ecs_log_set_levelEnable or disable tracing
ecs_strerrorGet description for error code

Defines

Defines (log.h)

ecs_log(level,...)
_ecs_log(level, __FILE__, __LINE__, __VA_ARGS__)

ecs_logv(level,fmt,args)
_ecs_logv(level, __FILE__, __LINE__, fmt, args)

_ecs_trace(file,line,...)
_ecs_log(0, file, line, __VA_ARGS__)

ecs_trace(...)
_ecs_trace(__FILE__, __LINE__, __VA_ARGS__)

_ecs_warn(file,line,...)
_ecs_log(-2, file, line, __VA_ARGS__)

ecs_warn(...)
_ecs_warn(__FILE__, __LINE__, __VA_ARGS__)

_ecs_err(file,line,...)
_ecs_log(-3, file, line, __VA_ARGS__)

ecs_err(...)
_ecs_err(__FILE__, __LINE__, __VA_ARGS__)

_ecs_fatal(file,line,...)
_ecs_log(-4, file, line, __VA_ARGS__)

ecs_fatal(...)
_ecs_fatal(__FILE__, __LINE__, __VA_ARGS__)

ecs_deprecated(...)
_ecs_deprecated(__FILE__, __LINE__, __VA_ARGS__)

ECS_TRACE_3 /* Enable all tracing in debug mode. May slow things down */

ecs_dbg_1(...)
ecs_log(1, __VA_ARGS__);

ecs_dbg_2(...)
ecs_log(2, __VA_ARGS__);

ecs_dbg_3(...)
ecs_log(3, __VA_ARGS__);

ecs_dbg ecs_dbg_1 /* Default debug tracing is at level 1 */

ecs_abort(error_code,...)
_ecs_abort(error_code, __FILE__, __LINE__, __VA_ARGS__);
ecs_os_abort(); abort(); /* satisfy compiler/static analyzers */

Abort Unconditionally aborts process.

ecs_assert(condition,error_code,...)
if (!_ecs_assert(condition, error_code, #condition, __FILE__, __LINE__, __VA_ARGS__)) {
ecs_os_abort();
}
assert(condition) /* satisfy compiler/static analyzers */

Assert Aborts if condition is false, disabled in debug mode.

ecs_dbg_assert(condition,error_code,...)
ecs_assert(condition, error_code, __VA_ARGS__)

Debug assert Assert that is only valid in debug mode (ignores FLECS_KEEP_ASSERT)

ecs_dummy_check if ((false)) {
goto error;
}

ecs_check(condition,error_code,...)
ecs_assert(condition, error_code, __VA_ARGS__);
ecs_dummy_check

Check goto error if condition is false.

ecs_throw(error_code,...)
ecs_abort(error_code, __VA_ARGS__);
ecs_dummy_check

Throw goto error when FLECS_SOFT_ASSERT is defined, otherwise abort

ecs_parser_error(name,expr,column,...)
_ecs_parser_error(name, expr, column, __VA_ARGS__)

Parser error

ecs_parser_errorv(name,expr,column,fmt,args)
_ecs_parser_errorv(name, expr, column, fmt, args)

ECS_INVALID_OPERATION (1)

ECS_INVALID_PARAMETER (2)

ECS_CONSTRAINT_VIOLATED (3)

ECS_OUT_OF_MEMORY (4)

ECS_OUT_OF_RANGE (5)

ECS_UNSUPPORTED (6)

ECS_INTERNAL_ERROR (7)

ECS_ALREADY_DEFINED (8)

ECS_MISSING_OS_API (9)

ECS_OPERATION_FAILED (10)

ECS_INVALID_CONVERSION (11)

ECS_INCONSISTENT_NAME (20)

ECS_NAME_IN_USE (21)

ECS_NOT_A_COMPONENT (22)

ECS_INVALID_COMPONENT_SIZE (23)

ECS_INVALID_COMPONENT_ALIGNMENT (24)

ECS_COMPONENT_NOT_REGISTERED (25)

ECS_INCONSISTENT_COMPONENT_ID (26)

ECS_INCONSISTENT_COMPONENT_ACTION (27)

ECS_MODULE_UNDEFINED (28)

ECS_MISSING_SYMBOL (29)

ECS_COLUMN_ACCESS_VIOLATION (40)

ECS_COLUMN_INDEX_OUT_OF_RANGE (41)

ECS_COLUMN_IS_NOT_SHARED (42)

ECS_COLUMN_IS_SHARED (43)

ECS_COLUMN_TYPE_MISMATCH (45)

ECS_TYPE_INVALID_CASE (62)

ECS_INVALID_WHILE_ITERATING (70)

ECS_LOCKED_STORAGE (71)

ECS_INVALID_FROM_WORKER (72)

ECS_BLACK "\033[1;30m"

ECS_RED "\033[0;31m"

ECS_GREEN "\033[0;32m"

ECS_YELLOW "\033[0;33m"

ECS_BLUE "\033[0;34m"

ECS_MAGENTA "\033[0;35m"

ECS_CYAN "\033[0;36m"

ECS_WHITE "\033[1;37m"

ECS_GREY "\033[0;37m"

ECS_NORMAL "\033[0;49m"

ECS_BOLD "\033[1;49m"