blob: b15e3c7eab5d0a027ca7a4822101050ae0af098d [file] [log] [blame]
#ifndef SPRINGBOK_H
#define SPRINGBOK_H
#include <springbok_intrinsics.h>
#include <stdio.h>
#define ERROR_TAG "ERROR"
#define INFO_TAG "INFO"
#define DEBUG_TAG "DEBUG"
#define ENDLINE "\n"
#define LOG_FMT "%s |"
#define LOG_ARGS(LOG_TAG) LOG_TAG
#define LOG_MAX_SZ 128
#define SIMLOG(sim_log_level,fmt, ...) \
do { \
char tmp_log_msg[LOG_MAX_SZ]; \
snprintf(tmp_log_msg, LOG_MAX_SZ, fmt, __VA_ARGS__); \
springbok_simprint_##sim_log_level(tmp_log_msg, 0); \
} while (0)
#define LOG_ERROR(msg, args...) SIMLOG(error, LOG_FMT msg ENDLINE, LOG_ARGS(ERROR_TAG), ## args)
#define LOG_WARN(msg, args...) SIMLOG(warning, LOG_FMT msg ENDLINE, LOG_ARGS(ERROR_TAG), ## args)
#define LOG_INFO(msg, args...) SIMLOG(info, LOG_FMT msg ENDLINE, LOG_ARGS(INFO_TAG), ## args)
#define LOG_DEBUG(msg, args...) SIMLOG(debug, LOG_FMT msg ENDLINE, LOG_ARGS(DEBUG_TAG), ## args)
#define LOG_NOISY(msg, args...) SIMLOG(noisy, LOG_FMT msg ENDLINE, LOG_ARGS(ERROR_TAG), ## args)
#endif