31#define DOMAIN "LOGGER"
43 "INFO: ",
"WARNING: ",
"ERROR: "};
45static const char color_escape_blue[] =
"\033[1;34m";
46static const char color_escape_reset[] =
"\033[0m";
48static bool pynq_log_init =
false;
53 unsigned int lineno,
char const *fmt, ...) {
59 char const *env = getenv(
"DEBUG");
64 env = getenv(
"FATAL_WARNING");
72 pynq_error(
"pynq_log: invalid log level specified (%d)\r\n", level);
76 if (level < min_log_level) {
79 fputs(color_escape_calls[level], stderr);
80 fputs(log_level_name[level], stderr);
82 fputs(color_escape_blue, stderr);
84 fprintf(stderr,
"%s::", domain);
86 fprintf(stderr,
"%s:%d ", location, lineno);
87 fputs(color_escape_reset, stderr);
89 va_start(arg_list, fmt);
90 vfprintf(stderr, fmt, arg_list);
92 if (fmt[strlen(fmt) - 1] !=
'\n') {
96 if (level >= critical_level) {
void pynq_log(const LogLevel level, char const *domain, char const *location, unsigned int lineno, char const *fmt,...)