|
Final Platform Layer 1.0.0
|
FPL has an internal logging system built-in.
By default this logging system is disabled, but you can enable it by defining the preprocessor definition FPL_LOGGING before including the FPL header file.
You can change the maximum log-level using fplSetMaxLogLevel() . By default, this is set to fplLogLevel_Critical which means that only system-wide critical errors will be reported.
When the logging system is enabled, you can get or change the configuration using fplGetLogSettings() / fplSetLogSettings() respectively.
This configuration has two modes: one shared writer used for every log level, or a separate writer for each log level. By default, it uses the first mode - one writer for all log levels.
To change this behavior, you can set the preprocessor definition FPL_LOG_MULTIPLE_WRITERS. With this, you can change the logging in every detail.
A log writer can be configured to log to multiple logging-targets.
FPL supports up to 4 log targets:
See fplLogWriterFlags and fplLogSettings for more details.
Log all errors, warnings, and criticals to the default error console.
Log all errors, warnings, and criticals to a custom callback defined as fpl_log_func_callback .
You can force to stop on a specific line of code always by calling the function fplDebugBreak() .
It works exactly like a breakpoint, but it will always break until you remove the call to it.
Example:
On IDE's such as visual studio you can use fplDebugOut() or fplDebugFormatOut() to print out stuff in the console directly in your IDE.
Example:
FPL contains runtime and compile-time assertion macros, which you can use to ensure application state consistency.
You can use the macro function fplAssert() to trigger a runtime assertion in a debug-build.
When the condition in your assertion is false, your application will crash immediately.
Example:
You can use the macro function fplStaticAssert() to trigger a compile-time assertion in a debug-build.
Example:
In Debug-Mode assertions are enabled, unless you have specified FPL_NO_ASSERTIONS.
In Release-Mode assertions are disabled, unless you have specified FPL_FORCE_ASSERTIONS.
You can use FPL_DEBUG or FPL_RELEASE to force either a "Release" or "Debug" mode.
See Compiler Options for more details.