1
0
Fork 0

Spectre/System/Log: adding debug method.

This commit is contained in:
Henrik Hautakoski 2020-10-13 18:06:21 +02:00
parent eb1f6303f1
commit 1a6cee0b25
2 changed files with 20 additions and 2 deletions

View file

@ -35,6 +35,17 @@ int Log::error(const char *message, ...)
return 1;
}
void Log::debug(const char *message, ...)
{
#ifdef SPECTRE_DEBUG
va_list vl;
va_start(vl, message);
writeln(T_DEBUG, message, vl);
va_end(vl);
#endif /* SPECTRE_DEBUG */
}
void Log::writeln(Type type, const char *message, va_list args)
{
FILE *fd = stderr;
@ -52,8 +63,12 @@ void Log::writeln(Type type, const char *message, va_list args)
case T_CRITICAL:
prefix = "CRIT";
break;
default :
case T_ERROR :
#ifdef SPECTRE_DEBUG
case T_DEBUG:
prefix = "DEBUG";
break;
#endif /* SPECTRE_DEBUG */
case T_ERROR : default :
prefix = "ERROR";
break;
}