5 * \brief Debug interface
8 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
9 * Alexander Warg <warg@os.inf.tu-dresden.de>
10 * economic rights: Technische Universität Dresden (Germany)
12 * This file is part of TUD:OS and distributed under the terms of the
13 * GNU General Public License 2.
14 * Please see the COPYING-GPL-2 file for details.
16 * As a special exception, you may use this file as part of a free software
17 * library without restriction. Specifically, if other files instantiate
18 * templates or use macros or inline functions from this file, or you compile
19 * this file and link it with other files to produce an executable, this
20 * file does not by itself cause the resulting executable to be covered by
21 * the GNU General Public License. This exception does not however
22 * invalidate any other reasons why the executable file might be covered by
23 * the GNU General Public License.
27 #include <l4/sys/types.h>
29 namespace L4Re { namespace Util {
39 static char const *const levels[];
42 { cprintf("%s: %s", _component, levels[_l]); }
44 int printf(char const *fmt, ...) const
45 __attribute__((format(printf,2,3)));
47 int cprintf(char const *fmt, ...) const
48 __attribute__((format(printf,2,3)));
51 Err(Level l, char const *component) : _l(l), _component(component)
56 char const *_component;
68 char const *const _component;
69 char const *const _subsys;
72 static unsigned long level;
74 static void set_level(unsigned long l) { level = l; }
76 bool is_active() const { return _m & level; }
78 int printf(char const *fmt, ...) const
79 __attribute__((format(printf, 2, 3)));
81 int cprintf(char const *fmt, ...) const
82 __attribute__((format(printf, 2, 3)));
86 Dbg(unsigned long mask, char const *comp, char const *subs)
87 : _m(mask), _component(comp), _subsys(subs)
93 static void set_level(unsigned long) {}
94 bool is_active() const { return false; }
96 int printf(char const * /*fmt*/, ...) const
97 __attribute__((format(printf, 2, 3)))
100 int cprintf(char const * /*fmt*/, ...) const
101 __attribute__((format(printf, 2, 3)))
106 Dbg(unsigned long, char const *, char const *) {}