only output playback status in console mode

This commit is contained in:
tildearrow 2021-12-18 04:26:17 -05:00
parent d4046de2e1
commit beceefd34b
5 changed files with 45 additions and 15 deletions

View file

@ -6,7 +6,11 @@ int logD(const char* format, ...) {
va_list va;
int ret;
if (logLevel<LOGLEVEL_DEBUG) return 0;
#ifdef _WIN32
printf("[debug] ");
#else
printf("\x1b[1;34m[debug]\x1b[m ");
#endif
va_start(va,format);
ret=vprintf(format,va);
va_end(va);
@ -18,7 +22,11 @@ int logI(const char* format, ...) {
va_list va;
int ret;
if (logLevel<LOGLEVEL_INFO) return 0;
#ifdef _WIN32
printf("[info] ");
#else
printf("\x1b[1;32m[info]\x1b[m ");
#endif
va_start(va,format);
ret=vprintf(format,va);
va_end(va);
@ -29,7 +37,11 @@ int logW(const char* format, ...) {
va_list va;
int ret;
if (logLevel<LOGLEVEL_WARN) return 0;
#ifdef _WIN32
printf("[warning] ");
#else
printf("\x1b[1;33m[warning]\x1b[m ");
#endif
va_start(va,format);
ret=vprintf(format,va);
va_end(va);
@ -40,7 +52,11 @@ int logE(const char* format, ...) {
va_list va;
int ret;
if (logLevel<LOGLEVEL_ERROR) return 0;
printf("\x1b[1;31m[ERROR]\x1b[m ");
#ifdef _WIN32
printf("[ERROR] ");
#else
printf("\x0b[1;31m[ERROR]\x1b[m ");
#endif
va_start(va,format);
ret=vprintf(format,va);
va_end(va);