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, ...)
| Base logging function.
#define | ecs_printv(level, fmt, args)
| Base logging function with va_list.
#define | ecs_log(level, ...)
| Log at the provided level.
#define | ecs_logv(level, fmt, args)
| Log at the provided level with va_list.
#define | ecs_trace_(file, line, ...)
| Tracing.
#define | ecs_trace(...)
| Tracing macro.
#define | ecs_warn_(file, line, ...)
| Warning.
#define | ecs_warn(...)
| Warning macro.
#define | ecs_err_(file, line, ...)
| Error.
#define | ecs_err(...)
| Error macro.
#define | ecs_fatal_(file, line, ...)
| Fatal.
#define | ecs_fatal(...)
| Fatal macro.
#define | ecs_deprecated(...)
| Optionally include warnings about using deprecated features.
#define | FLECS_LOG_3 /* Enable all tracing in debug mode. May slow things down */
#define | ecs_dbg_1(...)
| Debug trace at level 1.
#define | ecs_dbg_2(...)
| Debug trace at level 2.
#define | ecs_dbg_3(...)
| Debug trace at level 3.
#define | ecs_log_push_1()
| Push log indentation at level 1.
#define | ecs_log_push_2()
| Push log indentation at level 2.
#define | ecs_log_push_3()
| Push log indentation at level 3.
#define | ecs_log_pop_1()
| Pop log indentation at level 1.
#define | ecs_log_pop_2()
| Pop log indentation at level 2.
#define | ecs_log_pop_3()
| Pop log indentation at level 3.
#define | ecs_should_log_1()
| Test if level 1 logging is enabled.
#define | ecs_should_log_2()
| Test if level 2 logging is enabled.
#define | ecs_should_log_3()
| Test if level 3 logging is enabled.
#define | FLECS_LOG_2
#define | FLECS_LOG_1
#define | FLECS_LOG_0
#define | ecs_dbg ecs_dbg_1
| Default debug tracing is at level 1.
#define | ecs_log_push()
| Push log indentation at the default level.
#define | ecs_log_pop()
| Pop log indentation at the default level.
#define | ecs_abort(error_code, ...)
| Abort.
#define | ecs_assert(condition, error_code, ...)
| Assert.
#define | ecs_dbg_assert(condition, error_code, ...)
| Debug assert.
#define | ecs_always_assert(condition, error_code, ...)
| Always assert.
#define | ecs_san_assert(condition, error_code, ...)
| Sanitize assert.
#define | ecs_dummy_check
| Silence dead code/unused label warnings when compiling without checks.
#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)
| Parser error with va_list.
#define | ecs_parser_warning(name, expr, column, ...)
| Parser warning.
#define | ecs_parser_warningv(name, expr, column, fmt, args)
| Parser warning with va_list.
#define | ECS_INVALID_OPERATION (1)
| Invalid operation error code.
#define | ECS_INVALID_PARAMETER (2)
| Invalid parameter error code.
#define | ECS_CONSTRAINT_VIOLATED (3)
| Constraint violated error code.
#define | ECS_OUT_OF_MEMORY (4)
| Out of memory error code.
#define | ECS_OUT_OF_RANGE (5)
| Out of range error code.
#define | ECS_UNSUPPORTED (6)
| Unsupported error code.
#define | ECS_INTERNAL_ERROR (7)
| Internal error code.
#define | ECS_ALREADY_DEFINED (8)
| Already defined error code.
#define | ECS_MISSING_OS_API (9)
| Missing OS API error code.
#define | ECS_OPERATION_FAILED (10)
| Operation failed error code.
#define | ECS_INVALID_CONVERSION (11)
| Invalid conversion error code.
#define | ECS_CYCLE_DETECTED (13)
| Cycle detected error code.
#define | ECS_LEAK_DETECTED (14)
| Leak detected error code.
#define | ECS_DOUBLE_FREE (15)
| Double free error code.
#define | ECS_INCONSISTENT_NAME (20)
| Inconsistent name error code.
#define | ECS_NAME_IN_USE (21)
| Name in use error code.
#define | ECS_INVALID_COMPONENT_SIZE (23)
| Invalid component size error code.
#define | ECS_INVALID_COMPONENT_ALIGNMENT (24)
| Invalid component alignment error code.
#define | ECS_COMPONENT_NOT_REGISTERED (25)
| Component not registered error code.
#define | ECS_INCONSISTENT_COMPONENT_ID (26)
| Inconsistent component id error code.
#define | ECS_INCONSISTENT_COMPONENT_ACTION (27)
| Inconsistent component action error code.
#define | ECS_MODULE_UNDEFINED (28)
| Module undefined error code.
#define | ECS_MISSING_SYMBOL (29)
| Missing symbol error code.
#define | ECS_ALREADY_IN_USE (30)
| Already in use error code.
#define | ECS_ACCESS_VIOLATION (40)
| Access violation error code.
#define | ECS_COLUMN_INDEX_OUT_OF_RANGE (41)
| Column index out of range error code.
#define | ECS_COLUMN_IS_NOT_SHARED (42)
| Column is not shared error code.
#define | ECS_COLUMN_IS_SHARED (43)
| Column is shared error code.
#define | ECS_COLUMN_TYPE_MISMATCH (45)
| Column type mismatch error code.
#define | ECS_INVALID_WHILE_READONLY (70)
| Invalid while readonly error code.
#define | ECS_LOCKED_STORAGE (71)
| Locked storage error code.
#define | ECS_INVALID_FROM_WORKER (72)
| Invalid from worker error code.
#define | ECS_BLACK "\033[1;30m"
| Black ANSI color escape code.
#define | ECS_RED "\033[0;31m"
| Red ANSI color escape code.
#define | ECS_GREEN "\033[0;32m"
| Green ANSI color escape code.
#define | ECS_YELLOW "\033[0;33m"
| Yellow ANSI color escape code.
#define | ECS_BLUE "\033[0;34m"
| Blue ANSI color escape code.
#define | ECS_MAGENTA "\033[0;35m"
| Magenta ANSI color escape code.
#define | ECS_CYAN "\033[0;36m"
| Cyan ANSI color escape code.
#define | ECS_WHITE "\033[1;37m"
| White ANSI color escape code.
#define | ECS_GREY "\033[0;37m"
| Grey ANSI color escape code.
#define | ECS_NORMAL "\033[0;49m"
| Normal ANSI color escape code.
#define | ECS_BOLD "\033[1;49m"
| Bold ANSI escape code.

## 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,...)
| Print at the provided log level.
FLECS_API void | ecs_printv_ (int level, const char *file, int32_t line, const char *fmt, va_list args)
| Print at the provided log level (va_list).
FLECS_API void | ecs_log_ (int32_t level, const char *file, int32_t line, const char *fmt,...)
| Log at the provided level.
FLECS_API void | ecs_logv_ (int level, const char *file, int32_t line, const char *fmt, va_list args)
| Log at the provided level (va_list).
FLECS_API void | ecs_abort_ (int32_t error_code, const char *file, int32_t line, const char *fmt,...)
| Abort with error code.
FLECS_API void | ecs_assert_log_ (int32_t error_code, const char *condition_str, const char *file, int32_t line, const char *fmt,...)
| Log an assertion failure.
FLECS_API void | ecs_parser_error_ (const char *name, const char *expr, int64_t column, const char *fmt,...)
| Log a parser error.
FLECS_API void | ecs_parser_errorv_ (const char *name, const char *expr, int64_t column, const char *fmt, va_list args)
| Log a parser error (va_list).
FLECS_API void | ecs_parser_warning_ (const char *name, const char *expr, int64_t column, const char *fmt,...)
| Log a parser warning.
FLECS_API void | ecs_parser_warningv_ (const char *name, const char *expr, int64_t column, const char *fmt, va_list args)
| Log a parser warning (va_list).
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)
| Start capturing log output.
FLECS_API char * | ecs_log_stop_capture (void)
| Stop capturing log output.

## 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 */
ecs_abort_
FLECS_API void ecs_abort_(int32_t error_code, const char *file, int32_t line, const char *fmt,...)
Abort with error code.

Abort.

Unconditionally aborts the process.

Definition at line 464 of file log.h.

## ◆ ECS_ACCESS_VIOLATION

#define ECS_ACCESS_VIOLATION (40)

Access violation error code.

Definition at line 719 of file log.h.

## ◆ ECS_ALREADY_DEFINED

#define ECS_ALREADY_DEFINED (8)

Already defined error code.

Definition at line 683 of file log.h.

## ◆ ECS_ALREADY_IN_USE

#define ECS_ALREADY_IN_USE (30)

Already in use error code.

Definition at line 716 of file log.h.

## ◆ ecs_always_assert

#define ecs_always_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 */

Always assert.

Assert that is always active, even in release builds. Always aborts on failure (does not support FLECS_SOFT_ASSERT).

Definition at line 492 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 release mode.

Definition at line 473 of file log.h.

## ◆ ECS_BLACK

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

Black ANSI color escape code.

Definition at line 742 of file log.h.

## ◆ ECS_BLUE

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

Blue ANSI color escape code.

Definition at line 750 of file log.h.

## ◆ ECS_BOLD

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

Bold ANSI escape code.

Definition at line 762 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
ecs_dummy_check
#define ecs_dummy_check
Silence dead code/unused label warnings when compiling without checks.
Definition log.h:509

Check.

Go to error if condition is false.

Definition at line 527 of file log.h.

## ◆ ECS_COLUMN_INDEX_OUT_OF_RANGE

#define ECS_COLUMN_INDEX_OUT_OF_RANGE (41)

Column index out of range error code.

Definition at line 721 of file log.h.

## ◆ ECS_COLUMN_IS_NOT_SHARED

#define ECS_COLUMN_IS_NOT_SHARED (42)

Column is not shared error code.

Definition at line 723 of file log.h.

## ◆ ECS_COLUMN_IS_SHARED

#define ECS_COLUMN_IS_SHARED (43)

Column is shared error code.

Definition at line 725 of file log.h.

## ◆ ECS_COLUMN_TYPE_MISMATCH

#define ECS_COLUMN_TYPE_MISMATCH (45)

Column type mismatch error code.

Definition at line 727 of file log.h.

## ◆ ECS_COMPONENT_NOT_REGISTERED

#define ECS_COMPONENT_NOT_REGISTERED (25)

Component not registered error code.

Definition at line 706 of file log.h.

## ◆ ECS_CONSTRAINT_VIOLATED

#define ECS_CONSTRAINT_VIOLATED (3)

Constraint violated error code.

Definition at line 673 of file log.h.

## ◆ ECS_CYAN

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

Cyan ANSI color escape code.

Definition at line 754 of file log.h.

## ◆ ECS_CYCLE_DETECTED

#define ECS_CYCLE_DETECTED (13)

Cycle detected error code.

Definition at line 691 of file log.h.

## ◆ ecs_dbg

#define ecs_dbg ecs_dbg_1

Default debug tracing is at level 1.

Definition at line 455 of file log.h.

## ◆ ecs_dbg_1

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

Value:
ecs_log(1, __VA_ARGS__);
ecs_log
#define ecs_log(level,...)
Log at the provided level.
Definition log.h:299

Debug trace at level 1.

Definition at line 350 of file log.h.

## ◆ ecs_dbg_2

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

Value:
ecs_log(2, __VA_ARGS__);

Debug trace at level 2.

Definition at line 352 of file log.h.

## ◆ ecs_dbg_3

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

Value:
ecs_log(3, __VA_ARGS__);

Debug trace at level 3.

Definition at line 354 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:473

Debug assert.

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

Definition at line 484 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.

Optionally include warnings about using deprecated features.

Emit deprecation warning.

Definition at line 329 of file log.h.

## ◆ ECS_DOUBLE_FREE

#define ECS_DOUBLE_FREE (15)

Double free error code.

Definition at line 695 of file log.h.

## ◆ ecs_dummy_check

#define ecs_dummy_check

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

Silence dead code/unused label warnings when compiling without checks.

Definition at line 509 of file log.h.

## ◆ ecs_err

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

Value:
ecs_err_(__FILE__, __LINE__, __VA_ARGS__)
ecs_err_
#define ecs_err_(file, line,...)
Error.
Definition log.h:317

Error macro.

Definition at line 319 of file log.h.

## ◆ ecs_err_

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

Value:
ecs_log_(-3, file, line, __VA_ARGS__)
ecs_log_
FLECS_API void ecs_log_(int32_t level, const char *file, int32_t line, const char *fmt,...)
Log at the provided level.

Error.

Used when an issue occurs, and operation failed.

Definition at line 317 of file log.h.

## ◆ ecs_fatal

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

Value:
ecs_fatal_(__FILE__, __LINE__, __VA_ARGS__)
ecs_fatal_
#define ecs_fatal_(file, line,...)
Fatal.
Definition log.h:322

Fatal macro.

Definition at line 324 of file log.h.

## ◆ ecs_fatal_

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

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

Fatal.

Used when an issue occurs, and the application cannot continue.

Definition at line 322 of file log.h.

## ◆ ECS_GREEN

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

Green ANSI color escape code.

Definition at line 746 of file log.h.

## ◆ ECS_GREY

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

Grey ANSI color escape code.

Definition at line 758 of file log.h.

## ◆ ECS_INCONSISTENT_COMPONENT_ACTION

#define ECS_INCONSISTENT_COMPONENT_ACTION (27)

Inconsistent component action error code.

Definition at line 710 of file log.h.

## ◆ ECS_INCONSISTENT_COMPONENT_ID

#define ECS_INCONSISTENT_COMPONENT_ID (26)

Inconsistent component id error code.

Definition at line 708 of file log.h.

## ◆ ECS_INCONSISTENT_NAME

#define ECS_INCONSISTENT_NAME (20)

Inconsistent name error code.

Definition at line 698 of file log.h.

## ◆ ECS_INTERNAL_ERROR

#define ECS_INTERNAL_ERROR (7)

Internal error code.

Definition at line 681 of file log.h.

## ◆ ECS_INVALID_COMPONENT_ALIGNMENT

#define ECS_INVALID_COMPONENT_ALIGNMENT (24)

Invalid component alignment error code.

Definition at line 704 of file log.h.

## ◆ ECS_INVALID_COMPONENT_SIZE

#define ECS_INVALID_COMPONENT_SIZE (23)

Invalid component size error code.

Definition at line 702 of file log.h.

## ◆ ECS_INVALID_CONVERSION

#define ECS_INVALID_CONVERSION (11)

Invalid conversion error code.

Definition at line 689 of file log.h.

## ◆ ECS_INVALID_FROM_WORKER

#define ECS_INVALID_FROM_WORKER (72)

Invalid from worker error code.

Definition at line 734 of file log.h.

## ◆ ECS_INVALID_OPERATION

#define ECS_INVALID_OPERATION (1)

Invalid operation error code.

Definition at line 669 of file log.h.

## ◆ ECS_INVALID_PARAMETER

#define ECS_INVALID_PARAMETER (2)

Invalid parameter error code.

Definition at line 671 of file log.h.

## ◆ ECS_INVALID_WHILE_READONLY

#define ECS_INVALID_WHILE_READONLY (70)

Invalid while readonly error code.

Definition at line 730 of file log.h.

## ◆ ECS_LEAK_DETECTED

#define ECS_LEAK_DETECTED (14)

Leak detected error code.

Definition at line 693 of file log.h.

## ◆ ECS_LOCKED_STORAGE

#define ECS_LOCKED_STORAGE (71)

Locked storage error code.

Definition at line 732 of file log.h.

## ◆ ecs_log

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

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

Log at the provided level.

Definition at line 299 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.

Pop log indentation at the default level.

Definition at line 460 of file log.h.

## ◆ ecs_log_pop_1

#define ecs_log_pop_1 | ( |  | ) |

Value:
ecs_log_pop_(1);

Pop log indentation at level 1.

Definition at line 364 of file log.h.

## ◆ ecs_log_pop_2

#define ecs_log_pop_2 | ( |  | ) |

Value:
ecs_log_pop_(2);

Pop log indentation at level 2.

Definition at line 366 of file log.h.

## ◆ ecs_log_pop_3

#define ecs_log_pop_3 | ( |  | ) |

Value:
ecs_log_pop_(3);

Pop log indentation at level 3.

Definition at line 368 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.

Push log indentation at the default level.

Definition at line 458 of file log.h.

## ◆ ecs_log_push_1

#define ecs_log_push_1 | ( |  | ) |

Value:
ecs_log_push_(1);

Push log indentation at level 1.

Definition at line 357 of file log.h.

## ◆ ecs_log_push_2

#define ecs_log_push_2 | ( |  | ) |

Value:
ecs_log_push_(2);

Push log indentation at level 2.

Definition at line 359 of file log.h.

## ◆ ecs_log_push_3

#define ecs_log_push_3 | ( |  | ) |

Value:
ecs_log_push_(3);

Push log indentation at level 3.

Definition at line 361 of file log.h.

## ◆ ecs_logv

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

Value:
ecs_logv_(level, __FILE__, __LINE__, fmt, args)
ecs_logv_
FLECS_API void ecs_logv_(int level, const char *file, int32_t line, const char *fmt, va_list args)
Log at the provided level (va_list).

Log at the provided level with va_list.

Definition at line 303 of file log.h.

## ◆ ECS_MAGENTA

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

Magenta ANSI color escape code.

Definition at line 752 of file log.h.

## ◆ ECS_MISSING_OS_API

#define ECS_MISSING_OS_API (9)

Missing OS API error code.

Definition at line 685 of file log.h.

## ◆ ECS_MISSING_SYMBOL

#define ECS_MISSING_SYMBOL (29)

Missing symbol error code.

Definition at line 714 of file log.h.

## ◆ ECS_MODULE_UNDEFINED

#define ECS_MODULE_UNDEFINED (28)

Module undefined error code.

Definition at line 712 of file log.h.

## ◆ ECS_NAME_IN_USE

#define ECS_NAME_IN_USE (21)

Name in use error code.

Definition at line 700 of file log.h.

## ◆ ECS_NORMAL

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

Normal ANSI color escape code.

Definition at line 760 of file log.h.

## ◆ ECS_OPERATION_FAILED

#define ECS_OPERATION_FAILED (10)

Operation failed error code.

Definition at line 687 of file log.h.

## ◆ ECS_OUT_OF_MEMORY

#define ECS_OUT_OF_MEMORY (4)

Out of memory error code.

Definition at line 675 of file log.h.

## ◆ ECS_OUT_OF_RANGE

#define ECS_OUT_OF_RANGE (5)

Out of range error code.

Definition at line 677 of file log.h.

## ◆ ecs_parser_error

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

Value:
ecs_parser_error_(name, expr, column, __VA_ARGS__)
ecs_parser_error_
FLECS_API void ecs_parser_error_(const char *name, const char *expr, int64_t column, const char *fmt,...)
Log a parser error.

Parser error.

Definition at line 554 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)
ecs_parser_errorv_
FLECS_API void ecs_parser_errorv_(const char *name, const char *expr, int64_t column, const char *fmt, va_list args)
Log a parser error (va_list).

Parser error with va_list.

Definition at line 558 of file log.h.

## ◆ ecs_parser_warning

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

Value:
ecs_parser_warning_(name, expr, column, __VA_ARGS__)
ecs_parser_warning_
FLECS_API void ecs_parser_warning_(const char *name, const char *expr, int64_t column, const char *fmt,...)
Log a parser warning.

Parser warning.

Definition at line 562 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)
ecs_parser_warningv_
FLECS_API void ecs_parser_warningv_(const char *name, const char *expr, int64_t column, const char *fmt, va_list args)
Log a parser warning (va_list).

Parser warning with va_list.

Definition at line 566 of file log.h.

## ◆ ecs_print

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

Value:
ecs_print_(level, __FILE__, __LINE__, __VA_ARGS__)
ecs_print_
FLECS_API void ecs_print_(int32_t level, const char *file, int32_t line, const char *fmt,...)
Print at the provided log level.

Base logging function.

Accepts a custom level.

Definition at line 291 of file log.h.

## ◆ ecs_printv

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

Value:
ecs_printv_(level, __FILE__, __LINE__, fmt, args)
ecs_printv_
FLECS_API void ecs_printv_(int level, const char *file, int32_t line, const char *fmt, va_list args)
Print at the provided log level (va_list).

Base logging function with va_list.

Definition at line 295 of file log.h.

## ◆ ECS_RED

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

Red ANSI color escape code.

Definition at line 744 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 504 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.

Test if level 1 logging is enabled.

Definition at line 371 of file log.h.

## ◆ ecs_should_log_2

#define ecs_should_log_2 | ( |  | ) |

Value:
ecs_should_log(2)

Test if level 2 logging is enabled.

Definition at line 373 of file log.h.

## ◆ ecs_should_log_3

#define ecs_should_log_3 | ( |  | ) |

Value:
ecs_should_log(3)

Test if level 3 logging is enabled.

Definition at line 375 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:464

Panic.

Go to error when FLECS_SOFT_ASSERT is defined, otherwise abort.

Definition at line 547 of file log.h.

## ◆ ecs_trace

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

Value:
ecs_trace_(__FILE__, __LINE__, __VA_ARGS__)
ecs_trace_
#define ecs_trace_(file, line,...)
Tracing.
Definition log.h:307

Tracing macro.

Definition at line 309 of file log.h.

## ◆ ecs_trace_

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

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

Tracing.

Used for logging of infrequent events.

Definition at line 307 of file log.h.

## ◆ ECS_UNSUPPORTED

#define ECS_UNSUPPORTED (6)

Unsupported error code.

Definition at line 679 of file log.h.

## ◆ ecs_warn

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

Value:
ecs_warn_(__FILE__, __LINE__, __VA_ARGS__)
ecs_warn_
#define ecs_warn_(file, line,...)
Warning.
Definition log.h:312

Warning macro.

Definition at line 314 of file log.h.

## ◆ ecs_warn_

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

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

Warning.

Used when an issue occurs, but operation is successful.

Definition at line 312 of file log.h.

## ◆ ECS_WHITE

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

White ANSI color escape code.

Definition at line 756 of file log.h.

## ◆ ECS_YELLOW

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

Yellow ANSI color escape code.

Definition at line 748 of file log.h.

## ◆ FLECS_LOG_0

#define FLECS_LOG_0

Definition at line 379 of file log.h.

## ◆ FLECS_LOG_1

#define FLECS_LOG_1

Definition at line 378 of file log.h.

## ◆ FLECS_LOG_2

#define FLECS_LOG_2

Definition at line 377 of file log.h.

## ◆ FLECS_LOG_3

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

Definition at line 338 of file log.h.

## Function Documentation

## ◆ ecs_abort_()

FLECS_API void ecs_abort_ | ( | int32_t | error_code,
|  | const char * | file,
|  | int32_t | line,
|  | const char * | fmt,
|  |  | ... )

Abort with error code.

Parameters

  error_code | The error code.
  file | The source file.
  line | The source line.
  fmt | The format string.

## ◆ ecs_assert_log_()

FLECS_API void ecs_assert_log_ | ( | int32_t | error_code,
|  | const char * | condition_str,
|  | const char * | file,
|  | int32_t | line,
|  | const char * | fmt,
|  |  | ... )

Log an assertion failure.

Parameters

  error_code | The error code.
  condition_str | The condition that was not met.
  file | The source file.
  line | The source line.
  fmt | The format string.

## ◆ ecs_deprecated_()

FLECS_API void ecs_deprecated_ | ( | const char * | file,
|  | int32_t | line,
|  | const char * | msg )

Log message indicating an operation is deprecated.

Parameters

  file | The source file.
  line | The source line.
  msg | The deprecation message.

## ◆ ecs_log_()

FLECS_API void ecs_log_ | ( | int32_t | level,
|  | const char * | file,
|  | int32_t | line,
|  | const char * | fmt,
|  |  | ... )

Log at the provided level.

Parameters

  level | The log level.
  file | The source file.
  line | The source line.
  fmt | The format string.

## ◆ 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
  Current 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 the built-in 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_log_start_capture()

FLECS_API void ecs_log_start_capture | ( | bool | capture_try | ) |

Start capturing log output.

Parameters

  capture_try | If true, also capture messages from ecs_log_try blocks.

## ◆ ecs_log_stop_capture()

FLECS_API char * ecs_log_stop_capture | ( | void |  | ) |

Stop capturing log output.

Returns
  The captured log output, or NULL if no output was captured.

## ◆ ecs_logv_()

FLECS_API void ecs_logv_ | ( | int | level,
|  | const char * | file,
|  | int32_t | line,
|  | const char * | fmt,
|  | va_list | args )

Log at the provided level (va_list).

Parameters

  level | The log level.
  file | The source file.
  line | The source line.
  fmt | The format string.
  args | The format argument list.

## ◆ ecs_parser_error_()

FLECS_API void ecs_parser_error_ | ( | const char * | name,
|  | const char * | expr,
|  | int64_t | column,
|  | const char * | fmt,
|  |  | ... )

Log a parser error.

Parameters

  name | The name of the expression.
  expr | The expression string.
  column | The column at which the error occurred.
  fmt | The format string.

## ◆ ecs_parser_errorv_()

FLECS_API void ecs_parser_errorv_ | ( | const char * | name,
|  | const char * | expr,
|  | int64_t | column,
|  | const char * | fmt,
|  | va_list | args )

Log a parser error (va_list).

Parameters

  name | The name of the expression.
  expr | The expression string.
  column | The column at which the error occurred.
  fmt | The format string.
  args | The format argument list.

## ◆ ecs_parser_warning_()

FLECS_API void ecs_parser_warning_ | ( | const char * | name,
|  | const char * | expr,
|  | int64_t | column,
|  | const char * | fmt,
|  |  | ... )

Log a parser warning.

Parameters

  name | The name of the expression.
  expr | The expression string.
  column | The column at which the error occurred.
  fmt | The format string.

## ◆ ecs_parser_warningv_()

FLECS_API void ecs_parser_warningv_ | ( | const char * | name,
|  | const char * | expr,
|  | int64_t | column,
|  | const char * | fmt,
|  | va_list | args )

Log a parser warning (va_list).

Parameters

  name | The name of the expression.
  expr | The expression string.
  column | The column at which the error occurred.
  fmt | The format string.
  args | The format argument list.

## ◆ ecs_print_()

FLECS_API void ecs_print_ | ( | int32_t | level,
|  | const char * | file,
|  | int32_t | line,
|  | const char * | fmt,
|  |  | ... )

Print at the provided log level.

Parameters

  level | The log level.
  file | The source file.
  line | The source line.
  fmt | The format string.

## ◆ ecs_printv_()

FLECS_API void ecs_printv_ | ( | int | level,
|  | const char * | file,
|  | int32_t | line,
|  | const char * | fmt,
|  | va_list | args )

Print at the provided log level (va_list).

Parameters

  level | The log level.
  file | The source file.
  line | The source line.
  fmt | The format string.
  args | The format argument list.

## ◆ 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.

## ◆ ecs_strerror()

FLECS_API const char * ecs_strerror | ( | int32_t | error_code | ) |

Get description for error code.

Parameters

  error_code | The error code.

Returns
  String describing the error code.