reactor-c 1.0
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
logging.h
Go to the documentation of this file.
1
13#include <stdarg.h>
14
15// To silence warnings about a function being a candidate for format checking
16// with gcc, add an attribute.
17// The arguments are the position of the format string (starting with 1)
18// and the start of the remaining arguments, or 0 for vprintf style functions.
20#if defined(__GNUC__)
21#define ATTRIBUTE_FORMAT_PRINTF(f, s) __attribute__((format(printf, f, s)))
22#else
23#define ATTRIBUTE_FORMAT_PRINTF(f, s)
24#endif
26
45#define LOG_LEVEL_ERROR 0
46
53#define LOG_LEVEL_WARNING 1
54
61#define LOG_LEVEL_INFO 2
62
69#define LOG_LEVEL_LOG 3
70
77#define LOG_LEVEL_DEBUG 4
78
85#define LOG_LEVEL_ALL 255
86
97void lf_print(const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
98
109void lf_print_log(const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
110
121void lf_print_debug(const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
122
132void lf_print_error(const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
133
143void lf_print_warning(const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
144
155void lf_print_error_and_exit(const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
156
165void lf_print_error_system_failure(const char* format, ...);
166
174typedef void(print_message_function_t)(const char*, va_list);
175
void void void lf_print_debug(const char *format,...) ATTRIBUTE_FORMAT_PRINTF(1
Report an debug message on stdout with the prefix "DEBUG: " and a newline appended at the end.
void void void void void lf_print_warning(const char *format,...) ATTRIBUTE_FORMAT_PRINTF(1
Report a warning with the prefix "WARNING: " and a newline appended at the end.
void lf_register_print_function(print_message_function_t *function, int log_level)
Register a function to display messages.
void lf_print(const char *format,...) ATTRIBUTE_FORMAT_PRINTF(1
Report an informational message on stdout with a newline appended at the end.
void void lf_print_log(const char *format,...) ATTRIBUTE_FORMAT_PRINTF(1
Report an log message on stdout with the prefix "LOG: " and a newline appended at the end.
void void void void void void lf_print_error_and_exit(const char *format,...) ATTRIBUTE_FORMAT_PRINTF(1
Report an error with the prefix "ERROR: " and a newline appended at the end, then exit with the failu...
void void void void void void void lf_print_error_system_failure(const char *format,...)
Report an error and exit just like lf_print_error_and_exit(), but also print the system error message...
void print_message_function_t(const char *, va_list)
Message print function type.
Definition logging.h:174
void void void void lf_print_error(const char *format,...) ATTRIBUTE_FORMAT_PRINTF(1
Report an error with the prefix "ERROR: " and a newline appended at the end.