Fixes and updates to the new logger

This commit is contained in:
Walter Julius Hennecke 2013-08-25 03:18:03 +02:00
parent 296f3d106a
commit 633d9e653c
3 changed files with 23 additions and 17 deletions

View file

@ -4,7 +4,7 @@ void QDECL G_Logger (int level, char* fmt, ...) {
va_list argptr;
char text[1024];
if(level > g_logLevel.integer && g_logLevel.integer != LL_ALWAYS) {
if(level > g_logLevel.integer) {
return;
}
@ -15,23 +15,23 @@ void QDECL G_Logger (int level, char* fmt, ...) {
switch (level)
{
case LL_ERROR:
G_Printf(S_COLOR_RED "[game][error] %s", text);
G_Printf(S_COLOR_RED "[game][error] - %s", text);
break;
case LL_WARN:
G_Printf(S_COLOR_YELLOW "[game][warn] %s", text);
G_Printf(S_COLOR_YELLOW "[game][warn ] - %s", text);
break;
case LL_INFO:
G_Printf("[game][info] %s", text);
G_Printf("[game][info ] %s - ", text);
break;
case LL_DEBUG:
G_Printf("[game][info] %s", text);
G_Printf("[game][debug] %s - ", text);
break;
case LL_TRACE:
G_Printf("[game][trace] %s", text);
G_Printf("[game][trace] %s - ", text);
break;
case LL_ALWAYS:
default:
G_Printf("[game] %s", text);
G_Printf("[game] %s - ", text);
break;
}
}
@ -40,7 +40,7 @@ void QDECL _G_LocLogger (const char* file, int line, int level, char* fmt, ...)
va_list argptr;
char text[1024];
if(level > g_logLevel.integer && g_logLevel.integer != LL_ALWAYS) {
if(level > g_logLevel.integer) {
return;
}
@ -51,23 +51,29 @@ void QDECL _G_LocLogger (const char* file, int line, int level, char* fmt, ...)
switch (level)
{
case LL_ERROR:
G_Printf(S_COLOR_RED "[game][error] %s:%d - ", file, line);
G_Printf(S_COLOR_RED "[game][error][%s:%d] - ", file, line);
G_Printf(S_COLOR_RED "%s", text);
break;
case LL_WARN:
G_Printf(S_COLOR_YELLOW "[game][warn] %s:%d - ", file, line);
G_Printf(S_COLOR_YELLOW "[game][warn ][%s:%d] - ", file, line);
G_Printf(S_COLOR_YELLOW "%s", text);
break;
case LL_INFO:
G_Printf("[game][info] %s:%d - ", file, line);
G_Printf("[game][info ][%s:%d] - ", file, line);
G_Printf("%s", text);
break;
case LL_DEBUG:
G_Printf("[game][info] %s:%d - ", file, line);
G_Printf("[game][debug][%s:%d] - ", file, line);
G_Printf("%s", text);
break;
case LL_TRACE:
G_Printf("[game][trace] %s:%d - ", file, line);
G_Printf("[game][trace][%s:%d] - ", file, line);
G_Printf("%s", text);
break;
case LL_ALWAYS:
default:
G_Printf("[game] %s:%d - ", file, line);
G_Printf("[game] [%s:%d] - ", file, line);
G_Printf("%s", text);
break;
}
}

View file

@ -4,12 +4,12 @@
#include "g_local.h"
enum {
LL_ALWAYS,
LL_ERROR,
LL_WARN,
LL_INFO,
LL_DEBUG,
LL_TRACE,
LL_ALWAYS
LL_TRACE
};
#define G_LocLogger(X,...) _G_LocLogger(__FILE__, __LINE__, X, __VA_ARGS__)

View file

@ -474,7 +474,7 @@ static cvarTable_t gameCvarTable[] = {
{ &rpg_photonDamage, "rpg_photonDamage", "140", CVAR_ARCHIVE, 0, qfalse },
{ &rpg_photonAltDamage, "rpg_photonAltDamage", "140", CVAR_ARCHIVE, 0, qfalse },
{ &g_developer, "g_developer", "0", CVAR_ARCHIVE, 0, qfalse },
{ &g_logLevel, "g_loglevel", "1", CVAR_ARCHIVE, 0, qfalse }
{ &g_logLevel, "g_loglevel", "2", CVAR_ARCHIVE, 0, qfalse }
};
static int gameCvarTableSize = (int)(sizeof( gameCvarTable ) / sizeof( gameCvarTable[0] ));