reactor-c 1.0
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
logging.h
Go to the documentation of this file.
1
13#ifndef LOGGING_H
14#define LOGGING_H
15
16#include <stdarg.h>
17
18// To silence warnings about a function being a candidate for format checking
19// with gcc, add an attribute.
20// The arguments are the position of the format string (starting with 1)
21// and the start of the remaining arguments, or 0 for vprintf style functions.
23#if defined(__GNUC__)
24#define ATTRIBUTE_FORMAT_PRINTF(f, s) __attribute__((format(printf, f, s)))
25#else
26#define ATTRIBUTE_FORMAT_PRINTF(f, s)
27#endif
29
48#define LOG_LEVEL_ERROR 0
49
56#define LOG_LEVEL_WARNING 1
57
64#define LOG_LEVEL_INFO 2
65
72#define LOG_LEVEL_LOG 3
73
80#define LOG_LEVEL_DEBUG 4
81
88#define LOG_LEVEL_ALL 255
89
100void lf_print(const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
101
113void lf_print_info(const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
114
125void lf_print_log(const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
126
137void lf_print_debug(const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
138
148void lf_print_error(const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
149
159void lf_print_warning(const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
160
171void lf_print_error_and_exit(const char* format, ...) ATTRIBUTE_FORMAT_PRINTF(1, 2);
172
181void lf_print_error_system_failure(const char* format, ...);
182
190typedef void(print_message_function_t)(const char*, va_list);
191
204
205#endif // LOGGING_H
void 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 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 lf_print_info(const char *format,...) ATTRIBUTE_FORMAT_PRINTF(1
Report an informational message on stdout with no prefix and a newline appended at the end.
void 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.
void 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 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 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 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 print_message_function_t(const char *, va_list)
Message print function type.
Definition logging.h:190