1717extern "C" {
1818#endif
1919
20+ /**
21+ * @defgroup logging Logging
22+ * @details Definitions and functions relevant for telling measure where to log information to.
23+ * @{
24+ */
25+ /**
26+ * @brief Represents different levels of verbosity.
27+ * @details The enum values are sorted by verbosity. That is, for example, if logs should only be logged \c level
28+ * \c INFO or higher, then `level >= INFO` can be used to check what should be logged.
29+ */
30+ typedef enum tirexLogLevel_enum { TRACE , DEBUG , INFO , WARN , ERROR , CRITICAL } tirexLogLevel ;
31+
32+ /**
33+ * @brief Points to a function that takes in a log level, component, and message which should be logged.
34+ * @details The log callback can handle the call as it likes (including ignoring it for example because logging is set
35+ * to a lower verbosity or turned of). The \p component may be used to identify, where the log is comming from.
36+ */
37+ typedef void (* tirexLogCallback )(tirexLogLevel level , const char * component , const char * message );
38+
39+ /**
40+ * @brief Set a callback that should be used for all future logs.
41+ * @details Per default, nothing is logged and passing NULL for \p callback disables logging.
42+ *
43+ * @param callback Points to a function that takes in a log level, component, and message which should be logged. Pass
44+ * NULL to disable logging.
45+ */
46+ TIREX_TRACKER_EXPORT void tirexSetLogCallback (tirexLogCallback callback );
47+ /** @} */ // end of logging
48+
2049/**
2150 * @defgroup error Error handling
2251 * @details
@@ -26,6 +55,18 @@ extern "C" {
2655 * @brief Categorizes different classes of error.
2756 */
2857typedef enum tirexError_enum { TIREX_SUCCESS = 0 , TIREX_INVALID_ARGUMENT = 1 } tirexError ;
58+
59+ typedef void (* tirexAbortCallback )(const char * message );
60+
61+ TIREX_TRACKER_EXPORT void tirexSetAbortLevel (tirexLogLevel level );
62+
63+ /**
64+ * @brief Set a callback that should be used in case the program needs to abort.
65+ * @details Per default, [`abort()`](https://en.cppreference.com/w/c/program/abort.html) is used.
66+ *
67+ * @param callback
68+ */
69+ TIREX_TRACKER_EXPORT void tirexSetAbortCallback (tirexAbortCallback callback );
2970/** @} */ // end of error
3071
3172/**
@@ -281,35 +322,6 @@ tirexStartTracking(const tirexMeasureConf* measures, size_t pollIntervalMs, tire
281322TIREX_TRACKER_EXPORT tirexError tirexStopTracking (tirexMeasureHandle * handle , tirexResult * * result );
282323/** @} */ // end of measure
283324
284- /**
285- * @defgroup logging Logging
286- * @details Definitions and functions relevant for telling measure where to log information to.
287- * @{
288- */
289- /**
290- * @brief Represents different levels of verbosity.
291- * @details The enum values are sorted by verbosity. That is, for example, if logs should only be logged \c level
292- * \c INFO or higher, then `level >= INFO` can be used to check what should be logged.
293- */
294- typedef enum tirexLogLevel_enum { TRACE , DEBUG , INFO , WARN , ERROR , CRITICAL } tirexLogLevel ;
295-
296- /**
297- * @brief Points to a function that takes in a log level, component, and message which should be logged.
298- * @details The log callback can handle the call as it likes (including ignoring it for example because logging is set
299- * to a lower verbosity or turned of). The \p component may be used to identify, where the log is comming from.
300- */
301- typedef void (* tirexLogCallback )(tirexLogLevel level , const char * component , const char * message );
302-
303- /**
304- * @brief Set a callback that should be used for all future logs.
305- * @details Per default, nothing is logged and passing NULL for \p callback disables logging.
306- *
307- * @param callback Points to a function that takes in a log level, component, and message which should be logged. Pass
308- * NULL to disable logging.
309- */
310- TIREX_TRACKER_EXPORT void tirexSetLogCallback (tirexLogCallback callback );
311- /** @} */ // end of logging
312-
313325/**
314326 * @defgroup dataprovider Data Providers
315327 * @details Methods and definitions necessary to fetch information about the underlying data sources.
0 commit comments