strip added smb:// shares of their user/pass when adding, and instead store that...
[vuplus_xbmc] / lib / cmyth / librefmem / debug_refmem.c
1 /*
2  *  Copyright (C) 2004-2006, Eric Lund
3  *  http://www.mvpmc.org/
4  *
5  *  This library is free software; you can redistribute it and/or
6  *  modify it under the terms of the GNU Lesser General Public
7  *  License as published by the Free Software Foundation; either
8  *  version 2.1 of the License, or (at your option) any later version.
9  *
10  *  This library is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  *  Lesser General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Lesser General Public
16  *  License along with this library; if not, write to the Free Software
17  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19
20 /*
21  * debug.c - functions to produce and control debug output from
22  *           libcmyth routines.
23  */
24
25 #include <stdio.h>
26 #include <stdlib.h>
27 #include <stdarg.h>
28 #include <refmem_local.h>
29 #include <cmyth_local.h>
30
31 #include "debug.h"
32
33 static mvp_debug_ctx_t refmem_debug_ctx = MVP_DEBUG_CTX_INIT("refmem",
34                                                              REF_DBG_NONE,
35                                                              NULL);
36 /*
37  * refmem_dbg_level(int l)
38  * 
39  * Scope: PUBLIC
40  *
41  * Description
42  *
43  * Set the current debug level to the absolute setting 'l'
44  * permitting all debug messages with a debug level less
45  * than or equal to 'l' to be displayed.
46  *
47  * Return Value:
48  *
49  * None.
50  */
51 void
52 refmem_dbg_level(int l)
53 {
54         mvp_dbg_setlevel(&refmem_debug_ctx, l);
55 }
56
57 /*
58  * refmem_dbg_all()
59  * 
60  * Scope: PUBLIC
61  * 
62  * Description
63  *
64  * Set the current debug level so that all debug messages are displayed.
65  *
66  * Return Value:
67  *
68  * None.
69  */
70 void
71 refmem_dbg_all()
72 {
73         mvp_dbg_setlevel(&refmem_debug_ctx, REF_DBG_ALL);
74 }
75
76 /*
77  * refmem_dbg_none()
78  * 
79  * Scope: PUBLIC
80  * 
81  * Description
82  *
83  * Set the current debug level so that no debug messages are displayed.
84  *
85  * Return Value:
86  *
87  * None.
88  */
89 void
90 refmem_dbg_none()
91 {
92         mvp_dbg_setlevel(&refmem_debug_ctx, REF_DBG_NONE);
93 }
94
95 /*
96  * refmem_dbg()
97  * 
98  * Scope: PRIVATE (mapped to __refmem_dbg)
99  * 
100  * Description
101  *
102  * Print a debug message of level 'level' on 'stderr' provided that
103  * the current debug level allows messages of level 'level' to be
104  * printed.
105  *
106  * Return Value:
107  *
108  * None.
109  */
110 void
111 refmem_dbg(int level, char *fmt, ...)
112 {
113         va_list ap;
114
115         va_start(ap, fmt);
116         mvp_dbg(&refmem_debug_ctx, level, fmt, ap);
117         va_end(ap);
118 }