include/Spectre/System/Log.h: Change message variable name to format.
This commit is contained in:
parent
2bb0cbaf6b
commit
9928a3599e
2 changed files with 18 additions and 18 deletions
|
|
@ -18,13 +18,13 @@ public :
|
||||||
T_DEBUG = 1 << 3
|
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 :
|
private :
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,47 +6,47 @@
|
||||||
namespace sp
|
namespace sp
|
||||||
{
|
{
|
||||||
|
|
||||||
void Log::info(const char *message, ...) {
|
void Log::info(const char *format, ...) {
|
||||||
|
|
||||||
va_list vl;
|
va_list vl;
|
||||||
|
|
||||||
va_start(vl, message);
|
va_start(vl, format);
|
||||||
writeln(T_INFO, message, vl);
|
writeln(T_INFO, format, vl);
|
||||||
va_end(vl);
|
va_end(vl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Log::warn(const char *message, ...)
|
void Log::warn(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list vl;
|
va_list vl;
|
||||||
|
|
||||||
va_start(vl, message);
|
va_start(vl, format);
|
||||||
writeln(T_WARNING, message, vl);
|
writeln(T_WARNING, format, vl);
|
||||||
va_end(vl);
|
va_end(vl);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Log::error(const char *message, ...)
|
int Log::error(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list vl;
|
va_list vl;
|
||||||
|
|
||||||
va_start(vl, message);
|
va_start(vl, format);
|
||||||
writeln(T_ERROR, message, vl);
|
writeln(T_ERROR, format, vl);
|
||||||
va_end(vl);
|
va_end(vl);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Log::debug(const char *message, ...)
|
void Log::debug(const char *format, ...)
|
||||||
{
|
{
|
||||||
#ifdef SPECTRE_DEBUG
|
#ifdef SPECTRE_DEBUG
|
||||||
va_list vl;
|
va_list vl;
|
||||||
|
|
||||||
va_start(vl, message);
|
va_start(vl, format);
|
||||||
writeln(T_DEBUG, message, vl);
|
writeln(T_DEBUG, format, vl);
|
||||||
va_end(vl);
|
va_end(vl);
|
||||||
#endif /* SPECTRE_DEBUG */
|
#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;
|
FILE *fd = stderr;
|
||||||
static char buf[4096];
|
static char buf[4096];
|
||||||
|
|
@ -73,7 +73,7 @@ void Log::writeln(Type type, const char *message, va_list args)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
vsnprintf(buf, sizeof(buf), message, args);
|
vsnprintf(buf, sizeof(buf), format, args);
|
||||||
fprintf(fd, "%s: %s\n", prefix, buf);
|
fprintf(fd, "%s: %s\n", prefix, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue