1
0
Fork 0

include/Spectre/System/Log.h: Change message variable name to format.

This commit is contained in:
Henrik Hautakoski 2023-02-18 13:49:50 +01:00
parent 2bb0cbaf6b
commit 9928a3599e
2 changed files with 18 additions and 18 deletions

View file

@ -18,13 +18,13 @@ public :
T_DEBUG = 1 << 3
};
static void info(const char *message, ...);
static void info(const char *format, ...);
static void warn(const char *message, ...);
static void warn(const char *format, ...);
static int error(const char *message, ...);
static int error(const char *format, ...);
static void debug(const char *message, ...);
static void debug(const char *format, ...);
private :

View file

@ -6,47 +6,47 @@
namespace sp
{
void Log::info(const char *message, ...) {
void Log::info(const char *format, ...) {
va_list vl;
va_start(vl, message);
writeln(T_INFO, message, vl);
va_start(vl, format);
writeln(T_INFO, format, vl);
va_end(vl);
}
void Log::warn(const char *message, ...)
void Log::warn(const char *format, ...)
{
va_list vl;
va_start(vl, message);
writeln(T_WARNING, message, vl);
va_start(vl, format);
writeln(T_WARNING, format, vl);
va_end(vl);
}
int Log::error(const char *message, ...)
int Log::error(const char *format, ...)
{
va_list vl;
va_start(vl, message);
writeln(T_ERROR, message, vl);
va_start(vl, format);
writeln(T_ERROR, format, vl);
va_end(vl);
return 1;
}
void Log::debug(const char *message, ...)
void Log::debug(const char *format, ...)
{
#ifdef SPECTRE_DEBUG
va_list vl;
va_start(vl, message);
writeln(T_DEBUG, message, vl);
va_start(vl, format);
writeln(T_DEBUG, format, vl);
va_end(vl);
#endif /* SPECTRE_DEBUG */
}
void Log::writeln(Type type, const char *message, va_list args)
void Log::writeln(Type type, const char *format, va_list args)
{
FILE *fd = stderr;
static char buf[4096];
@ -73,7 +73,7 @@ void Log::writeln(Type type, const char *message, va_list args)
break;
}
vsnprintf(buf, sizeof(buf), message, args);
vsnprintf(buf, sizeof(buf), format, args);
fprintf(fd, "%s: %s\n", prefix, buf);
}