X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Flogging.c;h=1895b5b50fd912213a92645b1a6b8db5657ef0cc;hb=f5ee3595addf2954bbbd5dcb9d7de72b069750e7;hp=18f75fb6e0303785fc25e773287f294e1ec8a9ba;hpb=5c9451f7e03edf59a3066853ae544c9d120bf90a;p=tpg%2Facess2.git diff --git a/Kernel/logging.c b/Kernel/logging.c index 18f75fb6..1895b5b5 100644 --- a/Kernel/logging.c +++ b/Kernel/logging.c @@ -21,7 +21,11 @@ enum eLogLevels LOG_LEVEL_DEBUG, NUM_LOG_LEVELS }; -const char *csaLevelCodes[] = {"k","p","f","e","w","n","l","d"}; +const char *csaLevelColours[] = { + "\x1B[35m", "\x1B[34m", "\x1B[36m", "\x1B[31m", + "\x1B[33m", "\x1B[32m", "\x1B[0m", "\x1B[0m" + }; +const char *csaLevelCodes[] = {"k","p","f","e","w","n","l","d"}; // === TYPES === typedef struct sLogEntry @@ -50,10 +54,8 @@ void Log_Warning(char *Ident, char *Message, ...); void Log_Notice(char *Ident, char *Message, ...); void Log_Log(char *Ident, char *Message, ...); void Log_Debug(char *Ident, char *Message, ...); -//static Uint64 Log_Int_GetIdent(const char *Str); // === EXPORTS === -EXPORT(Log_KernelPanic); EXPORT(Log_Panic); EXPORT(Log_Error); EXPORT(Log_Warning); @@ -63,6 +65,7 @@ EXPORT(Log_Debug); // === GLOBALS === tSpinlock glLog; +tSpinlock glLogOutput; tLogList gLog; tLogList gLog_Levels[NUM_LOG_LEVELS]; @@ -74,10 +77,12 @@ void Log_AddEvent(char *Ident, int Level, char *Format, va_list Args) { int len; tLogEntry *ent; + va_list args_tmp; if( Level >= NUM_LOG_LEVELS ) return; - len = vsnprintf(NULL, 256, Format, Args); + va_copy(args_tmp, Args); + len = vsnprintf(NULL, 256, Format, args_tmp); //Log("len = %i", len); @@ -118,12 +123,15 @@ void Log_AddEvent(char *Ident, int Level, char *Format, va_list Args) */ void Log_Int_PrintMessage(tLogEntry *Entry) { - LogF("%018lli%s [%+8s] %s\n", + //LOCK( &glLogOutput ); + LogF("%s%014lli%s [%+8s] %s\x1B[0m\r\n", + csaLevelColours[Entry->Level], Entry->Time, csaLevelCodes[Entry->Level], Entry->Ident, Entry->Data ); + //RELEASE( &glLogOutput ); } /**