summaryrefslogtreecommitdiffstats
path: root/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/utils.c b/src/utils.c
index fb98471..5b0872d 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -23,6 +23,7 @@
23#include "utils.h" 23#include "utils.h"
24 24
25int toto_debug = 0; 25int toto_debug = 0;
26uint16_t dbg_mask = 0;
26 27
27/** 28/**
28 * Sets the level of debugging. Currently the only acceptable values are 0 and 29 * Sets the level of debugging. Currently the only acceptable values are 0 and
@@ -36,6 +37,15 @@ void iphone_set_debug(int level)
36} 37}
37 38
38 39
40/**
41 * Set debug ids to display. Values can be OR-ed
42 *
43 * @param level Set to 0 for no debugging or 1 for debugging.
44 */
45void iphone_set_debug_mask(uint16_t mask)
46{
47 dbg_mask = mask;
48}
39 49
40void log_debug_msg(const char *format, ...) 50void log_debug_msg(const char *format, ...)
41{ 51{
@@ -53,6 +63,21 @@ void log_debug_msg(const char *format, ...)
53#endif 63#endif
54} 64}
55 65
66void log_dbg_msg(uint16_t id, const char *format, ...)
67{
68#ifndef STRIP_DEBUG_CODE
69 if (id & dbg_mask) {
70 va_list args;
71 /* run the real fprintf */
72 va_start(args, format);
73
74 vfprintf(stderr, format, args);
75
76 va_end(args);
77 }
78#endif
79}
80
56inline void log_debug_buffer(const char *data, const int length) 81inline void log_debug_buffer(const char *data, const int length)
57{ 82{
58#ifndef STRIP_DEBUG_CODE 83#ifndef STRIP_DEBUG_CODE