KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
dbglog.h
Go to the documentation of this file.
1 /* KallistiOS ##version##
2 
3  kos/dbglog.h
4  Copyright (C)2004 Dan Potter
5 
6 */
7 
8 /** \file kos/dbglog.h
9  \brief A debugging log.
10 
11  This file contains declarations related a debugging log. This log can be
12  used to restrict log messages, for instance to make it so that only the most
13  urgent of messages get printed for a release version of a program.
14 
15  \author Dan Potter
16 */
17 
18 #ifndef __KOS_DBGLOG_H
19 #define __KOS_DBGLOG_H
20 
21 #include <kos/cdefs.h>
22 __BEGIN_DECLS
23 
24 #include <unistd.h>
25 #include <stdarg.h>
26 #include <kos/fs.h>
27 
28 /** \brief Kernel debugging printf.
29 
30  This function is similar to printf(), but filters its output through a log
31  level check before being printed. This way, you can set the level of debug
32  info you want to see (or want your users to see).
33 
34  \param level The level of importance of this message.
35  \param fmt Message format string.
36  \param ... Format arguments
37  \see dbglog_levels
38 */
39 void dbglog(int level, const char *fmt, ...) __printflike(2, 3);
40 
41 /** \defgroup dbglog_levels Log levels for dbglog
42 
43  This is the list of levels that are allowed to be passed into the dbglog()
44  function, representing different levels of importance.
45 
46  @{
47 */
48 #define DBG_DEAD 0 /**< \brief The system is dead */
49 #define DBG_CRITICAL 1 /**< \brief A critical error message */
50 #define DBG_ERROR 2 /**< \brief A normal error message */
51 #define DBG_WARNING 3 /**< \brief Potential problem */
52 #define DBG_NOTICE 4 /**< \brief Normal but significant */
53 #define DBG_INFO 5 /**< \brief Informational messages */
54 #define DBG_DEBUG 6 /**< \brief User debug messages */
55 #define DBG_KDEBUG 7 /**< \brief Kernel debug messages */
56 /** @} */
57 
58 /** \brief Set the debugging log level.
59 
60  This function sets the level for which dbglog() will ignore messages for if
61  the message has a higher level.
62 
63  \param level The level to stop paying attention after.
64  \see dbglog_levels
65 */
66 void dbglog_set_level(int level);
67 
68 __END_DECLS
69 
70 #endif /* __KOS_DBGLOG_H */
71 
void dbglog(int level, const char *fmt,...) __printflike(2
Kernel debugging printf.
void dbglog_set_level(int level)
Set the debugging log level.
#define __printflike(fmtarg, firstvararg)
Identify a function as accepting formatting like printf().
Definition: cdefs.h:61
Virtual filesystem support.
Potentially useful definitions for C Programs.