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
struct sLogEntry *Next;
struct sLogEntry *LevelNext;
Sint64 Time;
- char Ident[8];
int Level;
int Length;
+ char Ident[9];
char Data[];
} tLogEntry;
typedef struct sLogList
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);
// === GLOBALS ===
tSpinlock glLog;
+tSpinlock glLogOutput;
tLogList gLog;
tLogList gLog_Levels[NUM_LOG_LEVELS];
{
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);
+ //Log("len = %i", len);
ent = malloc(sizeof(tLogEntry)+len+1);
ent->Time = now();
- strncpy(ent->Ident, Ident, 7);
+ strncpy(ent->Ident, Ident, 8);
ent->Level = Level;
ent->Length = len;
vsnprintf( ent->Data, 256, Format, Args );
- Log("ent->Ident = '%s'", ent->Ident);
- Log("ent->Data = '%s'", ent->Data);
+ //Log("ent->Ident = '%s'", ent->Ident);
+ //Log("ent->Data = '%s'", ent->Data);
LOCK( &glLog );
*/
void Log_Int_PrintMessage(tLogEntry *Entry)
{
- LogF("%018i% [%8s] %s\n",
+ //LOCK( &glLogOutput );
+ LogF("%s%014lli%s [%+8s] %s\x1B[0m\n",
+ csaLevelColours[Entry->Level],
Entry->Time,
csaLevelCodes[Entry->Level],
Entry->Ident,
Entry->Data
);
+ //RELEASE( &glLogOutput );
}
/**