]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/io/server/src/debug.cc
update
[l4.git] / l4 / pkg / io / server / src / debug.cc
1 /*
2  * (c) 2011 Alexander Warg <warg@os.inf.tu-dresden.de>
3  *     economic rights: Technische Universität Dresden (Germany)
4  *
5  * This file is part of TUD:OS and distributed under the terms of the
6  * GNU General Public License 2.
7  * Please see the COPYING-GPL-2 file for details.
8  */
9
10 #include "debug.h"
11
12 #include <cstdio>
13 #include <cstdarg>
14
15 static unsigned _debug_level = 2;
16
17 void set_debug_level(unsigned level)
18 {
19   _debug_level = level;
20 }
21
22 bool dlevel(unsigned level)
23 {
24   return _debug_level >= level;
25 }
26
27 void d_printf(unsigned level, char const *fmt, ...)
28 {
29   if (_debug_level < level)
30     return;
31
32   va_list a;
33   va_start(a, fmt);
34   vprintf(fmt, a);
35   va_end(a);
36 }
37