3 * - By John Hodge (thePowersGang)
6 * - Logging / Debug printing functions
8 #ifndef _KERNEL__LOGDEBUG_H_
9 #define _KERNEL__LOGDEBUG_H_
15 * \name Logging to kernel ring buffer
18 extern void Log_KernelPanic(const char *Ident, const char *Message, ...);
19 extern void Log_Panic(const char *Ident, const char *Message, ...);
20 extern void Log_Error(const char *Ident, const char *Message, ...);
21 extern void Log_Warning(const char *Ident, const char *Message, ...);
22 extern void Log_Notice(const char *Ident, const char *Message, ...);
23 extern void Log_Log(const char *Ident, const char *Message, ...);
24 extern void Log_Debug(const char *Ident, const char *Message, ...);
31 * \name Debugging and Errors
34 extern void Debug_KernelPanic(void); //!< Initiate a kernel panic
35 extern void Panic(const char *Msg, ...); //!< Print a panic message (initiates a kernel panic)
36 extern void Warning(const char *Msg, ...); //!< Print a warning message
37 extern void LogF(const char *Fmt, ...); //!< Print a log message without a trailing newline
38 extern void LogFV(const char *Fmt, va_list Args); //!< va_list non-newline log message
39 extern void Log(const char *Fmt, ...); //!< Print a log message
40 extern void Debug(const char *Fmt, ...); //!< Print a debug message (doesn't go to KTerm)
41 extern void LogV(const char *Fmt, va_list Args); //!< va_list Log message
42 extern void Debug_Enter(const char *FuncName, const char *ArgTypes, ...);
43 extern void Debug_Log(const char *FuncName, const char *Fmt, ...);
44 extern void Debug_Leave(const char *FuncName, char RetType, ...);
45 extern void Debug_HexDump(const char *Header, const void *Data, size_t Length);
46 #define UNIMPLEMENTED() Warning("'%s' unimplemented", __func__)
48 # define ENTER(_types...) Debug_Enter((char*)__func__, _types)
49 # define LOG(_fmt...) Debug_Log((char*)__func__, _fmt)
50 # define LEAVE(_t...) Debug_Leave((char*)__func__, _t)
51 # define LEAVE_RET(_t,_v...) do{LEAVE(_t,_v);return _v;}while(0)
52 # define LEAVE_RET0() do{LEAVE('-');return;}while(0)
57 # define LEAVE_RET(_t,_v...) return (_v)
58 # define LEAVE_RET0() return
61 # define ASSERT(expr) do{if(!(expr))Panic("%s:%i - %s: Assertion '"#expr"' failed",__FILE__,__LINE__,(char*)__func__);}while(0)