Babeltrace 2 C API
2.0.0
Open-source trace manipulation framework
|
Logging level enumerators and library logging control.
The logging API offers logging level enumerators (bt_logging_level) as well as functions to control libbabeltrace2's internal logging.
libbabeltrace2 contains many hundreds of logging statements to help you follow and debug your plugin or program.
The library's initial logging level is controlled by the LIBBABELTRACE2_INIT_LOG_LEVEL
environment variable. If this environment variable is not set at library load time, the library's initial logging level is BT_LOGGING_LEVEL_NONE. See Logging to learn more.
Set libbabeltrace2's current logging level with bt_logging_set_global_level().
bt_logging_set_global_level() only controls libbabeltrace2's logging level; it does not control the logging level of:
As of Babeltrace 2.0, there's no module-specific logging level control: bt_logging_set_global_level() sets the logging level of all the library's modules.
libbabeltrace2 writes its logging statements to the standard error stream. A logging line looks like this:
See Logging to learn more about the logging statement line's format.
You can set a minimal logging level at the Babeltrace 2 project's build time (see Logging to learn how). The logging statements with a level that's less severe than the minimal logging level are not built. For example, if the minimal logging level is BT_LOGGING_LEVEL_INFO, the BT_LOGGING_LEVEL_TRACE and BT_LOGGING_LEVEL_DEBUG logging statements are not built. Use bt_logging_get_minimal_level() to get the library's minimal logging level.
Typedefs | |
typedef enum bt_logging_level | bt_logging_level |
Logging level enumerators. | |
Enumerations | |
enum | bt_logging_level { BT_LOGGING_LEVEL_TRACE, BT_LOGGING_LEVEL_DEBUG, BT_LOGGING_LEVEL_INFO, BT_LOGGING_LEVEL_WARNING, BT_LOGGING_LEVEL_ERROR, BT_LOGGING_LEVEL_FATAL, BT_LOGGING_LEVEL_NONE } |
Logging level enumerators. More... | |
Functions | |
void | bt_logging_set_global_level (bt_logging_level logging_level) |
Sets the logging level of all the libbabeltrace2 modules to logging_level. More... | |
bt_logging_level | bt_logging_get_global_level (void) |
Returns the current logging level of all the libbabeltrace2 modules. More... | |
bt_logging_level | bt_logging_get_minimal_level (void) |
Returns the library's minimal (build-time) logging level. More... | |
enum bt_logging_level |
Logging level enumerators.
void bt_logging_set_global_level | ( | bt_logging_level | logging_level | ) |
Sets the logging level of all the libbabeltrace2 modules to logging_level.
The library's global logging level does not affect the logging level of individual components and query operations.
[in] | logging_level | New library's global logging level. |
bt_logging_level bt_logging_get_global_level | ( | void | ) |
Returns the current logging level of all the libbabeltrace2 modules.
bt_logging_level bt_logging_get_minimal_level | ( | void | ) |
Returns the library's minimal (build-time) logging level.
The library logging statements with a level that's less severe than the minimal logging level are not built.
For example, if the minimal logging level is BT_LOGGING_LEVEL_INFO, the BT_LOGGING_LEVEL_TRACE and BT_LOGGING_LEVEL_DEBUG logging statements are not built.