50 lines
1.0 KiB
C
50 lines
1.0 KiB
C
//
|
|
// Created by auric on 2/21/24.
|
|
//
|
|
|
|
#include "nprint.h"
|
|
#include <stdio.h>
|
|
|
|
void nprint(const char *tag, const char *format, ...) {
|
|
const char *color = "";
|
|
const char *bgcolor = "";
|
|
const char *reset = "\033[0m";
|
|
va_list args;
|
|
|
|
switch(*tag) {
|
|
case 'X':
|
|
color = "\033[1;30m";
|
|
bgcolor = "\033[43m";
|
|
break;
|
|
case 'E':
|
|
color = "\033[1;31m";
|
|
break;
|
|
case 'S':
|
|
color = "\033[1;32m";
|
|
break;
|
|
case 'W':
|
|
color = "\033[1;33m";
|
|
break;
|
|
case 'I':
|
|
color = "\033[1;34m";
|
|
break;
|
|
case 'D':
|
|
color = "\033[1;35m";
|
|
break;
|
|
case 'Y':
|
|
color = "\033[1;35m";
|
|
bgcolor = "\033[43m";
|
|
break;
|
|
default:
|
|
color = "\033[1m";
|
|
}
|
|
|
|
printf("[%s%s%s%s] ", bgcolor, color, tag, reset);
|
|
|
|
va_start(args, format);
|
|
vprintf(format, args);
|
|
va_end(args);
|
|
|
|
printf("\n");
|
|
}
|