static void Debug_Puts(int bUseKTerm, const char *Str);
void Debug_DbgOnlyFmt(const char *format, va_list args);
void Debug_FmtS(int bUseKTerm, const char *format, ...);
-void Debug_Fmt(int bUseKTerm, const char *format, va_list args);
+bool Debug_Fmt(int bUseKTerm, const char *format, va_list args);
void Debug_SetKTerminal(const char *File);
// === GLOBALS ===
Debug_Fmt(0, format, args);
}
-void Debug_Fmt(int bUseKTerm, const char *format, va_list args)
+bool Debug_Fmt(int bUseKTerm, const char *format, va_list args)
{
char buf[DEBUG_MAX_LINE_LEN];
buf[DEBUG_MAX_LINE_LEN-1] = 0;
- int len = vsnprintf(buf, DEBUG_MAX_LINE_LEN-1, format, args);
+ size_t len = vsnprintf(buf, DEBUG_MAX_LINE_LEN-1, format, args);
Debug_Puts(bUseKTerm, buf);
if( len > DEBUG_MAX_LINE_LEN-1 ) {
// do something
Debug_Puts(bUseKTerm, "[...]");
+ return false;
}
- return ;
+ return true;
}
void Debug_FmtS(int bUseKTerm, const char *format, ...)
/**
* \fn void LogF(const char *Msg, ...)
* \brief Raw debug log (no new line, no prefix)
+ * \return True if all of the provided text was printed
*/
-void LogF(const char *Fmt, ...)
+bool LogF(const char *Fmt, ...)
{
- va_list args;
-
#if LOCK_DEBUG_OUTPUT
- if(CPU_HAS_LOCK(&glDebug_Lock)) return ;
+ if(CPU_HAS_LOCK(&glDebug_Lock)) return true;
SHORTLOCK(&glDebug_Lock);
#endif
+ va_list args;
va_start(args, Fmt);
-
- Debug_Fmt(1, Fmt, args);
-
+ bool rv = Debug_Fmt(1, Fmt, args);
va_end(args);
#if LOCK_DEBUG_OUTPUT
SHORTREL(&glDebug_Lock);
#endif
+ return rv;
}
/**
* \fn void Debug(const char *Msg, ...)
extern void Debug_KernelPanic(void); //!< Initiate a kernel panic
extern void Panic(const char *Msg, ...) NORETURN; //!< Print a panic message (initiates a kernel panic)
extern void Warning(const char *Msg, ...); //!< Print a warning message
-extern void LogF(const char *Fmt, ...); //!< Print a log message without a trailing newline
+extern bool LogF(const char *Fmt, ...); //!< Print a log message without a trailing newline
extern void LogFV(const char *Fmt, va_list Args); //!< va_list non-newline log message
extern void Log(const char *Fmt, ...); //!< Print a log message
extern void Debug(const char *Fmt, ...); //!< Print a debug message (doesn't go to KTerm)
if( CPU_HAS_LOCK(&glLogOutput) )
return ; // TODO: Error?
SHORTLOCK( &glLogOutput );
- LogF("%s%014lli",
+ bool completed = LogF(
+ "%s%014lli%s [%-8s] %i - %.*s\x1B[0m\r\n",
csaLevelColours[Entry->Level],
- Entry->Time
- );
- LogF("%s [%-8s] %i - %.*s",
+ Entry->Time,
csaLevelCodes[Entry->Level],
Entry->Ident,
Threads_GetTID(),
Entry->Length,
Entry->Data
);
- LogF("\x1B[0m\r\n"); // Separate in case Entry->Data is too long
+ if( !completed )
+ LogF("\x1B[0m\r\n"); // Separate in case Entry->Data is too long
SHORTREL( &glLogOutput );
}