MentOS
0.8.0
The Mentoring Operating System
|
Debugging primitives. More...
Go to the source code of this file.
Macros | |
#define | __DEBUG_LEVEL__ LOGLEVEL_NOTICE |
Defines the debug level, by default we set it to notice. | |
#define | __DEBUG_HEADER__ 0 |
Header for identifying outputs coming from a mechanism. | |
#define | __FILENAME__ (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __FILE__) |
Extract the filename from the full path provided by FILE. | |
#define | pr_default(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_DEFAULT, __VA_ARGS__) |
Prints a default message, which is always shown. | |
#define | pr_emerg(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_EMERG, __VA_ARGS__) |
Prints an emergency message. | |
#define | pr_alert(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_ALERT, __VA_ARGS__) |
Prints an alert message. | |
#define | pr_crit(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_CRIT, __VA_ARGS__) |
Prints a critical message. | |
#define | pr_err(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_ERR, __VA_ARGS__) |
Prints an error message. | |
#define | pr_warning(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_WARNING, __VA_ARGS__) |
Prints a warning message. | |
#define | pr_notice(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_NOTICE, __VA_ARGS__) |
Prints a notice message. | |
#define | pr_info(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_INFO, __VA_ARGS__) |
Prints a info message. | |
#define | pr_debug(...) dbg_printf(__FILENAME__, __func__, __LINE__, __DEBUG_HEADER__, LOGLEVEL_DEBUG, __VA_ARGS__) |
Prints a debug message. | |
Functions | |
void | set_log_level (int level) |
Sets the loglevel. More... | |
int | get_log_level (void) |
Returns the current loglevel. More... | |
void | dbg_putchar (char c) |
Prints the given character to debug output. More... | |
void | dbg_puts (const char *s) |
Prints the given string to debug output. More... | |
void | dbg_printf (const char *file, const char *fun, int line, char *header, short log_level, const char *format,...) |
Prints the given string to the debug output. More... | |
const char * | to_human_size (unsigned long bytes) |
Transforms the given amount of bytes to a readable string. More... | |
const char * | dec_to_binary (unsigned long value, unsigned length) |
Transforms the given value to a binary string. More... | |
Debugging primitives.
void dbg_printf | ( | const char * | file, |
const char * | fun, | ||
int | line, | ||
char * | header, | ||
short | log_level, | ||
const char * | format, | ||
... | |||
) |
Prints the given string to the debug output.
file | the name of the file. |
fun | the name of the function. |
line | the line inside the file. |
header | the header to print. |
log_level | the log level. |
format | the format to used, see printf. |
... | the list of arguments. |
void dbg_putchar | ( | char | c | ) |
Prints the given character to debug output.
c | The character to print. |
void dbg_puts | ( | const char * | s | ) |
Prints the given string to debug output.
s | The string to print. |
const char* dec_to_binary | ( | unsigned long | value, |
unsigned | length | ||
) |
Transforms the given value to a binary string.
value | to print. |
length | of the binary output. |
int get_log_level | ( | void | ) |
Returns the current loglevel.
void set_log_level | ( | int | level | ) |
Sets the loglevel.
level | The new loglevel. |
const char* to_human_size | ( | unsigned long | bytes | ) |
Transforms the given amount of bytes to a readable string.
bytes | The bytes to turn to string. |