Spectre/System/Log: adding debug method.
This commit is contained in:
parent
eb1f6303f1
commit
1a6cee0b25
2 changed files with 20 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue