Logging options. More...
#include <bio.h>
Data Fields | |
const char * | current_filename |
Full path to the file that is calling bio_init. | |
int | current_depth_in_project |
The depth of the calling file in your project tree. | |
Logging options.
Typically, it would be used like this:
This helps the logging system to shorten the paths in log messages. The logging macros use the preprocessor variables __FILE__
and __LINE__
to give more context to each message. However, __FILE__
would typically expands into an absolute path (e.g: /home/username/projects/project_name/src/file.c
). This gives the log messages an extremely long and superflous prefix:
By passing these info to the log system, the above message will be just:
The bio_log_ctx_t::file passed to each logger will be the shortened version.
When this option is not provided, filename shortening will not be performed.
Take note that if you have source files out of the project tree (e.g: /home/username/projects/another_project_name
), filename shortening will not be performed either and the full path will be logged. It is recommended to keep dependencies in the source tree (e.g: /home/username/projects/project_name/deps
). In that case, any logging calls from dependencies will show up as deps/dependency_name
.
int bio_log_options_t::current_depth_in_project |
The depth of the calling file in your project tree.
If the file that is calling bio_init is src/main.c
for example, this should be 1.
const char* bio_log_options_t::current_filename |
Full path to the file that is calling bio_init.