Write some basic logging macros

This commit is contained in:
Daniel Thorpe 2024-06-20 15:57:21 +01:00
parent 2a8be1c462
commit bcfd4a839d
No known key found for this signature in database

18
lib/include/logging.h Normal file
View File

@ -0,0 +1,18 @@
#ifndef LOGGING_H
#define LOGGING_H
#include <stdio.h>
#define LOG_ERROR(format, ...) \
do { \
fprintf(stderr, "ERROR %s: ", __func__); \
vfprintf(stderr, format, __VA_ARGS__); \
} while (0)
#define LOG_INFO(format, ...) \
do { \
fprintf(stderr, "INFO %s: ", __func__); \
vfprintf(stderr, format, __VA_ARGS__); \
} while (0)
#endif