#include #include #include char *current_file = "file.asm"; int log_disabled = 1; __attribute__((format(printf, 4, 5))) void __log_impl_pos(int line, int column, int type, const char *format, ...) { if (log_disabled) return; va_list list; va_start(list, format); char *t = NULL; switch (type) { case __DEBUG: t = "\033[34mdebug:\033[0m"; break; case __WARNING: t = "\033[35mwarning:\033[0m"; break; case __ERROR: t = "\033[31merror:\033[0m"; break; } printf("%s:%d:%d: %s ", current_file, line, column, t); vprintf(format, list); putchar('\n'); } __attribute__((format(printf, 2, 3))) void __log_impl(int type, const char *format, ...) { if (log_disabled) return; va_list list; va_start(list, format); char *t = NULL; switch (type) { case __DEBUG: t = "\033[34mdebug:\033[0m"; break; case __WARNING: t = "\033[35mwarning:\033[0m"; break; case __ERROR: t = "\033[31merror:\033[0m"; break; } printf("%s ", t); vprintf(format, list); putchar('\n'); }