Flecs: Log
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.1 A fast entity component system (ECS) for C & C++

Loading...
Searching...
No Matches
Log
C API » Addons

Logging functions. More...

Collaboration diagram for Log:

## Macros
#define | ecs_print(level, ...)
#define | ecs_printv(level, fmt, args)
#define | ecs_log(level, ...)
#define | ecs_logv(level, fmt, args)
#define | ecs_trace_(file, line, ...)
#define | ecs_trace(...)
#define | ecs_warn_(file, line, ...)
#define | ecs_warn(...)
#define | ecs_err_(file, line, ...)
#define | ecs_err(...)
#define | ecs_fatal_(file, line, ...)
#define | ecs_fatal(...)
#define | ecs_deprecated(...)
#define | FLECS_LOG_3 /* Enable all tracing in debug mode. May slow things down */
#define | ecs_dbg_1(...)
#define | ecs_dbg_2(...)
#define | ecs_dbg_3(...)
#define | ecs_log_push_1()
#define | ecs_log_push_2()
#define | ecs_log_push_3()
#define | ecs_log_pop_1()
#define | ecs_log_pop_2()
#define | ecs_log_pop_3()
#define | ecs_should_log_1()
#define | ecs_should_log_2()
#define | ecs_should_log_3()
#define | FLECS_LOG_2
#define | FLECS_LOG_1
#define | FLECS_LOG_0
#define | ecs_dbg ecs_dbg_1
#define | ecs_log_push()
#define | ecs_log_pop()
#define | ecs_abort(error_code, ...)
| Abort.
#define | ecs_assert(condition, error_code, ...)
| Assert.
#define | ecs_dbg_assert(condition, error_code, ...)
| Debug assert.
#define | ecs_san_assert(condition, error_code, ...)
| Sanitize assert.
#define | ecs_dummy_check
#define | ecs_check(condition, error_code, ...)
| Check.
#define | ecs_throw(error_code, ...)
| Panic.
#define | ecs_parser_error(name, expr, column, ...)
| Parser error.
#define | ecs_parser_errorv(name, expr, column, fmt, args)
#define | ecs_parser_warning(name, expr, column, ...)
#define | ecs_parser_warningv(name, expr, column, fmt, args)
#define | ECS_INVALID_OPERATION (1)
#define | ECS_INVALID_PARAMETER (2)
#define | ECS_CONSTRAINT_VIOLATED (3)
#define | ECS_OUT_OF_MEMORY (4)
#define | ECS_OUT_OF_RANGE (5)
#define | ECS_UNSUPPORTED (6)
#define | ECS_INTERNAL_ERROR (7)
#define | ECS_ALREADY_DEFINED (8)
#define | ECS_MISSING_OS_API (9)
#define | ECS_OPERATION_FAILED (10)
#define | ECS_INVALID_CONVERSION (11)
#define | ECS_CYCLE_DETECTED (13)
#define | ECS_LEAK_DETECTED (14)
#define | ECS_DOUBLE_FREE (15)
#define | ECS_INCONSISTENT_NAME (20)
#define | ECS_NAME_IN_USE (21)
#define | ECS_INVALID_COMPONENT_SIZE (23)
#define | ECS_INVALID_COMPONENT_ALIGNMENT (24)
#define | ECS_COMPONENT_NOT_REGISTERED (25)
#define | ECS_INCONSISTENT_COMPONENT_ID (26)
#define | ECS_INCONSISTENT_COMPONENT_ACTION (27)
#define | ECS_MODULE_UNDEFINED (28)
#define | ECS_MISSING_SYMBOL (29)
#define | ECS_ALREADY_IN_USE (30)
#define | ECS_ACCESS_VIOLATION (40)
#define | ECS_COLUMN_INDEX_OUT_OF_RANGE (41)
#define | ECS_COLUMN_IS_NOT_SHARED (42)
#define | ECS_COLUMN_IS_SHARED (43)
#define | ECS_COLUMN_TYPE_MISMATCH (45)
#define | ECS_INVALID_WHILE_READONLY (70)
#define | ECS_LOCKED_STORAGE (71)
#define | ECS_INVALID_FROM_WORKER (72)
#define | ECS_BLACK "\033[1;30m"
#define | ECS_RED "\033[0;31m"
#define | ECS_GREEN "\033[0;32m"
#define | ECS_YELLOW "\033[0;33m"
#define | ECS_BLUE "\033[0;34m"
#define | ECS_MAGENTA "\033[0;35m"
#define | ECS_CYAN "\033[0;36m"
#define | ECS_WHITE "\033[1;37m"
#define | ECS_GREY "\033[0;37m"
#define | ECS_NORMAL "\033[0;49m"
#define | ECS_BOLD "\033[1;49m"

## Functions
FLECS_API void | ecs_deprecated_ (const char *file, int32_t line, const char *msg)
| Log message indicating an operation is deprecated.
FLECS_API void | ecs_log_push_ (int32_t level)
| Increase log stack.
FLECS_API void | ecs_log_pop_ (int32_t level)
| Decrease log stack.
FLECS_API bool | ecs_should_log (int32_t level)
| Should current level be logged.
FLECS_API const char * | ecs_strerror (int32_t error_code)
| Get description for error code.
FLECS_API void | ecs_print_ (int32_t level, const char *file, int32_t line, const char *fmt,...)
FLECS_API void | ecs_printv_ (int level, const char *file, int32_t line, const char *fmt, va_list args)
FLECS_API void | ecs_log_ (int32_t level, const char *file, int32_t line, const char *fmt,...)
FLECS_API void | ecs_logv_ (int level, const char *file, int32_t line, const char *fmt, va_list args)
FLECS_API void | ecs_abort_ (int32_t error_code, const char *file, int32_t line, const char *fmt,...)
FLECS_API void | ecs_assert_log_ (int32_t error_code, const char *condition_str, const char *file, int32_t line, const char *fmt,...)
FLECS_API void | ecs_parser_error_ (const char *name, const char *expr, int64_t column, const char *fmt,...)
FLECS_API void | ecs_parser_errorv_ (const char *name, const char *expr, int64_t column, const char *fmt, va_list args)
FLECS_API void | ecs_parser_warning_ (const char *name, const char *expr, int64_t column, const char *fmt,...)
FLECS_API void | ecs_parser_warningv_ (const char *name, const char *expr, int64_t column, const char *fmt, va_list args)
FLECS_API int | ecs_log_set_level (int level)
| Enable or disable log.
FLECS_API int | ecs_log_get_level (void)
| Get current log level.
FLECS_API bool | ecs_log_enable_colors (bool enabled)
| Enable/disable tracing with colors.
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.
FLECS_API int | ecs_log_last_error (void)
| Get last logged error code.
FLECS_API void | ecs_log_start_capture (bool capture_try)
FLECS_API char * | ecs_log_stop_capture (void)

## Detailed Description

Logging functions.

## Macro Definition Documentation

## ◆ ecs_abort

#define ecs_abort | ( |  | error_code,
|  |  | ... )

Value:
ecs_abort_(error_code, __FILE__, __LINE__, __VA_ARGS__);\
ecs_os_abort(); abort(); /* satisfy compiler/static analyzers */

Abort.

Unconditionally aborts process.

Definition at line 359 of file log.h.

## ◆ ECS_ACCESS_VIOLATION

#define ECS_ACCESS_VIOLATION (40)

Definition at line 569 of file log.h.

## ◆ ECS_ALREADY_DEFINED

#define ECS_ALREADY_DEFINED (8)

Definition at line 550 of file log.h.

## ◆ ECS_ALREADY_IN_USE

#define ECS_ALREADY_IN_USE (30)

Definition at line 567 of file log.h.

## ◆ ecs_assert

#define ecs_assert | ( |  | condition,
|  |  | error_code,
|  |  | ... )

Value:
if (!(condition)) {\
ecs_assert_log_(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.

Definition at line 368 of file log.h.

## ◆ ECS_BLACK

#define ECS_BLACK "\033[1;30m"

Definition at line 584 of file log.h.

## ◆ ECS_BLUE

#define ECS_BLUE "\033[0;34m"

Definition at line 588 of file log.h.

## ◆ ECS_BOLD

#define ECS_BOLD "\033[1;49m"

Definition at line 594 of file log.h.

## ◆ ecs_check

#define ecs_check | ( |  | condition,
|  |  | error_code,
|  |  | ... )

Value:
if (!(condition)) {\
ecs_assert_log_(error_code, #condition, __FILE__, __LINE__, __VA_ARGS__);\
ecs_os_abort();\
}\
assert(condition); /* satisfy compiler/static analyzers */ \
ecs_dummy_check

Check.

goto error if condition is false.

Definition at line 412 of file log.h.

## ◆ ECS_COLUMN_INDEX_OUT_OF_RANGE

#define ECS_COLUMN_INDEX_OUT_OF_RANGE (41)

Definition at line 570 of file log.h.

## ◆ ECS_COLUMN_IS_NOT_SHARED

#define ECS_COLUMN_IS_NOT_SHARED (42)

Definition at line 571 of file log.h.

## ◆ ECS_COLUMN_IS_SHARED

#define ECS_COLUMN_IS_SHARED (43)

Definition at line 572 of file log.h.

## ◆ ECS_COLUMN_TYPE_MISMATCH

#define ECS_COLUMN_TYPE_MISMATCH (45)

Definition at line 573 of file log.h.

## ◆ ECS_COMPONENT_NOT_REGISTERED

#define ECS_COMPONENT_NOT_REGISTERED (25)

Definition at line 562 of file log.h.

## ◆ ECS_CONSTRAINT_VIOLATED

#define ECS_CONSTRAINT_VIOLATED (3)

Definition at line 545 of file log.h.

## ◆ ECS_CYAN

#define ECS_CYAN "\033[0;36m"

Definition at line 590 of file log.h.

## ◆ ECS_CYCLE_DETECTED

#define ECS_CYCLE_DETECTED (13)

Definition at line 554 of file log.h.

## ◆ ecs_dbg

#define ecs_dbg ecs_dbg_1

Definition at line 351 of file log.h.

## ◆ ecs_dbg_1

#define ecs_dbg_1 | ( |  | ... | ) |

Value:
ecs_log(1, __VA_ARGS__);

Definition at line 257 of file log.h.

## ◆ ecs_dbg_2

#define ecs_dbg_2 | ( |  | ... | ) |

Value:
ecs_log(2, __VA_ARGS__);

Definition at line 258 of file log.h.

## ◆ ecs_dbg_3

#define ecs_dbg_3 | ( |  | ... | ) |

Value:
ecs_log(3, __VA_ARGS__);

Definition at line 259 of file log.h.

## ◆ ecs_dbg_assert

#define ecs_dbg_assert | ( |  | condition,
|  |  | error_code,
|  |  | ... )

Value:
ecs_assert(condition, error_code, __VA_ARGS__)
ecs_assert
#define ecs_assert(condition, error_code,...)
Assert.
Definition log.h:368

Debug assert.

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

Definition at line 379 of file log.h.

## ◆ ecs_deprecated

#define ecs_deprecated | ( |  | ... | ) |

Value:
ecs_deprecated_(__FILE__, __LINE__, __VA_ARGS__)
ecs_deprecated_
FLECS_API void ecs_deprecated_(const char *file, int32_t line, const char *msg)
Log message indicating an operation is deprecated.

Definition at line 237 of file log.h.

## ◆ ECS_DOUBLE_FREE

#define ECS_DOUBLE_FREE (15)

Definition at line 556 of file log.h.

## ◆ ecs_dummy_check

#define ecs_dummy_check

Value:
if ((false)) {\
goto error;\
}

Definition at line 394 of file log.h.

## ◆ ecs_err

#define ecs_err | ( |  | ... | ) |

Value:
ecs_err_(__FILE__, __LINE__, __VA_ARGS__)

Definition at line 229 of file log.h.

## ◆ ecs_err_

#define ecs_err_ | ( |  | file,
|  |  | line,
|  |  | ... )

Value:
ecs_log_(-3, file, line, __VA_ARGS__)

Definition at line 228 of file log.h.

## ◆ ecs_fatal

#define ecs_fatal | ( |  | ... | ) |

Value:
ecs_fatal_(__FILE__, __LINE__, __VA_ARGS__)

Definition at line 233 of file log.h.

## ◆ ecs_fatal_

#define ecs_fatal_ | ( |  | file,
|  |  | line,
|  |  | ... )

Value:
ecs_log_(-4, file, line, __VA_ARGS__)

Definition at line 232 of file log.h.

## ◆ ECS_GREEN

#define ECS_GREEN "\033[0;32m"

Definition at line 586 of file log.h.

## ◆ ECS_GREY

#define ECS_GREY "\033[0;37m"

Definition at line 592 of file log.h.

## ◆ ECS_INCONSISTENT_COMPONENT_ACTION

#define ECS_INCONSISTENT_COMPONENT_ACTION (27)

Definition at line 564 of file log.h.

## ◆ ECS_INCONSISTENT_COMPONENT_ID

#define ECS_INCONSISTENT_COMPONENT_ID (26)

Definition at line 563 of file log.h.

## ◆ ECS_INCONSISTENT_NAME

#define ECS_INCONSISTENT_NAME (20)

Definition at line 558 of file log.h.

## ◆ ECS_INTERNAL_ERROR

#define ECS_INTERNAL_ERROR (7)

Definition at line 549 of file log.h.

## ◆ ECS_INVALID_COMPONENT_ALIGNMENT

#define ECS_INVALID_COMPONENT_ALIGNMENT (24)

Definition at line 561 of file log.h.

## ◆ ECS_INVALID_COMPONENT_SIZE

#define ECS_INVALID_COMPONENT_SIZE (23)

Definition at line 560 of file log.h.

## ◆ ECS_INVALID_CONVERSION

#define ECS_INVALID_CONVERSION (11)

Definition at line 553 of file log.h.

## ◆ ECS_INVALID_FROM_WORKER

#define ECS_INVALID_FROM_WORKER (72)

Definition at line 577 of file log.h.

## ◆ ECS_INVALID_OPERATION

#define ECS_INVALID_OPERATION (1)

Definition at line 543 of file log.h.

## ◆ ECS_INVALID_PARAMETER

#define ECS_INVALID_PARAMETER (2)

Definition at line 544 of file log.h.

## ◆ ECS_INVALID_WHILE_READONLY

#define ECS_INVALID_WHILE_READONLY (70)

Definition at line 575 of file log.h.

## ◆ ECS_LEAK_DETECTED

#define ECS_LEAK_DETECTED (14)

Definition at line 555 of file log.h.

## ◆ ECS_LOCKED_STORAGE

#define ECS_LOCKED_STORAGE (71)

Definition at line 576 of file log.h.

## ◆ ecs_log

#define ecs_log | ( |  | level,
|  |  | ... )

Value:
ecs_log_(level, __FILE__, __LINE__, __VA_ARGS__)

Definition at line 213 of file log.h.

## ◆ ecs_log_pop

#define ecs_log_pop | ( |  | ) |

Value:
ecs_log_pop_(0)
ecs_log_pop_
FLECS_API void ecs_log_pop_(int32_t level)
Decrease log stack.

Definition at line 355 of file log.h.

## ◆ ecs_log_pop_1

#define ecs_log_pop_1 | ( |  | ) |

Value:
ecs_log_pop_(1);

Definition at line 265 of file log.h.

## ◆ ecs_log_pop_2

#define ecs_log_pop_2 | ( |  | ) |

Value:
ecs_log_pop_(2);

Definition at line 266 of file log.h.

## ◆ ecs_log_pop_3

#define ecs_log_pop_3 | ( |  | ) |

Value:
ecs_log_pop_(3);

Definition at line 267 of file log.h.

## ◆ ecs_log_push

#define ecs_log_push | ( |  | ) |

Value:
ecs_log_push_(0)
ecs_log_push_
FLECS_API void ecs_log_push_(int32_t level)
Increase log stack.

Definition at line 354 of file log.h.

## ◆ ecs_log_push_1

#define ecs_log_push_1 | ( |  | ) |

Value:
ecs_log_push_(1);

Definition at line 261 of file log.h.

## ◆ ecs_log_push_2

#define ecs_log_push_2 | ( |  | ) |

Value:
ecs_log_push_(2);

Definition at line 262 of file log.h.

## ◆ ecs_log_push_3

#define ecs_log_push_3 | ( |  | ) |

Value:
ecs_log_push_(3);

Definition at line 263 of file log.h.

## ◆ ecs_logv

#define ecs_logv | ( |  | level,
|  |  | fmt,
|  |  | args )

Value:
ecs_logv_(level, __FILE__, __LINE__, fmt, args)

Definition at line 216 of file log.h.

## ◆ ECS_MAGENTA

#define ECS_MAGENTA "\033[0;35m"

Definition at line 589 of file log.h.

## ◆ ECS_MISSING_OS_API

#define ECS_MISSING_OS_API (9)

Definition at line 551 of file log.h.

## ◆ ECS_MISSING_SYMBOL

#define ECS_MISSING_SYMBOL (29)

Definition at line 566 of file log.h.

## ◆ ECS_MODULE_UNDEFINED

#define ECS_MODULE_UNDEFINED (28)

Definition at line 565 of file log.h.

## ◆ ECS_NAME_IN_USE

#define ECS_NAME_IN_USE (21)

Definition at line 559 of file log.h.

## ◆ ECS_NORMAL

#define ECS_NORMAL "\033[0;49m"

Definition at line 593 of file log.h.

## ◆ ECS_OPERATION_FAILED

#define ECS_OPERATION_FAILED (10)

Definition at line 552 of file log.h.

## ◆ ECS_OUT_OF_MEMORY

#define ECS_OUT_OF_MEMORY (4)

Definition at line 546 of file log.h.

## ◆ ECS_OUT_OF_RANGE

#define ECS_OUT_OF_RANGE (5)

Definition at line 547 of file log.h.

## ◆ ecs_parser_error

#define ecs_parser_error | ( |  | name,
|  |  | expr,
|  |  | column,
|  |  | ... )

Value:
ecs_parser_error_(name, expr, column, __VA_ARGS__)

Parser error.

Definition at line 439 of file log.h.

## ◆ ecs_parser_errorv

#define ecs_parser_errorv | ( |  | name,
|  |  | expr,
|  |  | column,
|  |  | fmt,
|  |  | args )

Value:
ecs_parser_errorv_(name, expr, column, fmt, args)

Definition at line 442 of file log.h.

## ◆ ecs_parser_warning

#define ecs_parser_warning | ( |  | name,
|  |  | expr,
|  |  | column,
|  |  | ... )

Value:
ecs_parser_warning_(name, expr, column, __VA_ARGS__)

Definition at line 445 of file log.h.

## ◆ ecs_parser_warningv

#define ecs_parser_warningv | ( |  | name,
|  |  | expr,
|  |  | column,
|  |  | fmt,
|  |  | args )

Value:
ecs_parser_warningv_(name, expr, column, fmt, args)

Definition at line 448 of file log.h.

## ◆ ecs_print

#define ecs_print | ( |  | level,
|  |  | ... )

Value:
ecs_print_(level, __FILE__, __LINE__, __VA_ARGS__)

Definition at line 207 of file log.h.

## ◆ ecs_printv

#define ecs_printv | ( |  | level,
|  |  | fmt,
|  |  | args )

Value:
ecs_printv_(level, __FILE__, __LINE__, fmt, args)

Definition at line 210 of file log.h.

## ◆ ECS_RED

#define ECS_RED "\033[0;31m"

Definition at line 585 of file log.h.

## ◆ ecs_san_assert

#define ecs_san_assert | ( |  | condition,
|  |  | error_code,
|  |  | ... )

Sanitize assert.

Assert that is only valid in sanitized mode (ignores FLECS_KEEP_ASSERT)

Definition at line 389 of file log.h.

## ◆ ecs_should_log_1

#define ecs_should_log_1 | ( |  | ) |

Value:
ecs_should_log(1)
ecs_should_log
FLECS_API bool ecs_should_log(int32_t level)
Should current level be logged.

Definition at line 269 of file log.h.

## ◆ ecs_should_log_2

#define ecs_should_log_2 | ( |  | ) |

Value:
ecs_should_log(2)

Definition at line 270 of file log.h.

## ◆ ecs_should_log_3

#define ecs_should_log_3 | ( |  | ) |

Value:
ecs_should_log(3)

Definition at line 271 of file log.h.

## ◆ ecs_throw

#define ecs_throw | ( |  | error_code,
|  |  | ... )

Value:
ecs_abort(error_code, __VA_ARGS__);\
ecs_dummy_check
ecs_abort
#define ecs_abort(error_code,...)
Abort.
Definition log.h:359

Panic.

goto error when FLECS_SOFT_ASSERT is defined, otherwise abort

Definition at line 432 of file log.h.

## ◆ ecs_trace

#define ecs_trace | ( |  | ... | ) |

Value:
ecs_trace_(__FILE__, __LINE__, __VA_ARGS__)

Definition at line 221 of file log.h.

## ◆ ecs_trace_

#define ecs_trace_ | ( |  | file,
|  |  | line,
|  |  | ... )

Value:
ecs_log_(0, file, line, __VA_ARGS__)

Definition at line 220 of file log.h.

## ◆ ECS_UNSUPPORTED

#define ECS_UNSUPPORTED (6)

Definition at line 548 of file log.h.

## ◆ ecs_warn

#define ecs_warn | ( |  | ... | ) |

Value:
ecs_warn_(__FILE__, __LINE__, __VA_ARGS__)

Definition at line 225 of file log.h.

## ◆ ecs_warn_

#define ecs_warn_ | ( |  | file,
|  |  | line,
|  |  | ... )

Value:
ecs_log_(-2, file, line, __VA_ARGS__)

Definition at line 224 of file log.h.

## ◆ ECS_WHITE

#define ECS_WHITE "\033[1;37m"

Definition at line 591 of file log.h.

## ◆ ECS_YELLOW

#define ECS_YELLOW "\033[0;33m"

Definition at line 587 of file log.h.

## ◆ FLECS_LOG_0

#define FLECS_LOG_0

Definition at line 275 of file log.h.

## ◆ FLECS_LOG_1

#define FLECS_LOG_1

Definition at line 274 of file log.h.

## ◆ FLECS_LOG_2

#define FLECS_LOG_2

Definition at line 273 of file log.h.

## ◆ FLECS_LOG_3

#define FLECS_LOG_3 /* Enable all tracing in debug mode. May slow things down */

Definition at line 246 of file log.h.

## Function Documentation

## ◆ ecs_log_enable_colors()

FLECS_API bool ecs_log_enable_colors | ( | bool | enabled | ) |

Enable/disable tracing with colors.

By default colors are enabled.

Parameters

  enabled | Whether to enable tracing with colors.

Returns
  Previous color setting.

## ◆ ecs_log_enable_timedelta()

FLECS_API bool ecs_log_enable_timedelta | ( | bool | enabled | ) |

Enable/disable logging time since last log.

By default deltatime is disabled. Note that enabling timestamps introduces overhead as the logging code will need to obtain the current time.

When enabled, this logs the amount of time in seconds passed since the last log, when this amount is non-zero. The format is a '+' character followed by the number of seconds:

    +1 trace: log message

Parameters

  enabled | Whether to enable tracing with timestamps.

Returns
  Previous timestamp setting.

## ◆ ecs_log_enable_timestamp()

FLECS_API bool ecs_log_enable_timestamp | ( | bool | enabled | ) |

Enable/disable logging timestamp.

By default timestamps are disabled. Note that enabling timestamps introduces overhead as the logging code will need to obtain the current time.

Parameters

  enabled | Whether to enable tracing with timestamps.

Returns
  Previous timestamp setting.

## ◆ ecs_log_get_level()

FLECS_API int ecs_log_get_level | ( | void |  | ) |

Get current log level.

Returns
  Previous log level.

## ◆ ecs_log_last_error()

FLECS_API int ecs_log_last_error | ( | void |  | ) |

Get last logged error code.

Calling this operation resets the error code.

Returns
  Last error, 0 if none was logged since last call to last_error.

## ◆ ecs_log_pop_()

FLECS_API void ecs_log_pop_ | ( | int32_t | level | ) |

Decrease log stack.

This operation decreases the indent_ value of the OS API and can be useful to make nested behavior more visible.

Parameters

  level | The log level.

## ◆ ecs_log_push_()

FLECS_API void ecs_log_push_ | ( | int32_t | level | ) |

Increase log stack.

This operation increases the indent_ value of the OS API and can be useful to make nested behavior more visible.

Parameters

  level | The log level.

## ◆ ecs_log_set_level()

FLECS_API int ecs_log_set_level | ( | int | level | ) |

Enable or disable log.

This will enable builtin log. For log to work, it will have to be compiled in which requires defining one of the following macros:

FLECS_LOG_0 - All log is disabled FLECS_LOG_1 - Enable log level 1 FLECS_LOG_2 - Enable log level 2 and below FLECS_LOG_3 - Enable log level 3 and below

If no log level is defined and this is a debug build, FLECS_LOG_3 will have been automatically defined.

The provided level corresponds with the log level. If -1 is provided as value, warnings are disabled. If -2 is provided, errors are disabled as well.

Parameters

  level | Desired tracing level.

Returns
  Previous log level.

## ◆ ecs_should_log()

FLECS_API bool ecs_should_log | ( | int32_t | level | ) |

Should current level be logged.

This operation returns true when the specified log level should be logged with the current log level.

Parameters

  level | The log level to check for.

Returns
  Whether logging is enabled for the current level.