1 |
/* |
---|
2 |
* Copyright (C) 2005-2008 by Daniel Wagner |
---|
3 |
* Copyright (C) 2005-2008 by Pieter Palmers |
---|
4 |
* |
---|
5 |
* This file is part of FFADO |
---|
6 |
* FFADO = Free Firewire (pro-)audio drivers for linux |
---|
7 |
* |
---|
8 |
* FFADO is based upon FreeBoB. |
---|
9 |
* |
---|
10 |
* This program is free software: you can redistribute it and/or modify |
---|
11 |
* it under the terms of the GNU General Public License as published by |
---|
12 |
* the Free Software Foundation, either version 2 of the License, or |
---|
13 |
* (at your option) version 3 of the License. |
---|
14 |
* |
---|
15 |
* This program is distributed in the hope that it will be useful, |
---|
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 |
* GNU General Public License for more details. |
---|
19 |
* |
---|
20 |
* You should have received a copy of the GNU General Public License |
---|
21 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
22 |
* |
---|
23 |
*/ |
---|
24 |
|
---|
25 |
#include "debugmodule.h" |
---|
26 |
|
---|
27 |
#include <iostream> |
---|
28 |
|
---|
29 |
using namespace std; |
---|
30 |
|
---|
31 |
class Test |
---|
32 |
{ |
---|
33 |
public: |
---|
34 |
Test() |
---|
35 |
{} |
---|
36 |
~Test() |
---|
37 |
{} |
---|
38 |
|
---|
39 |
bool run() { |
---|
40 |
cout << "######################" << endl; |
---|
41 |
cout << "### Test arguments ###" << endl; |
---|
42 |
cout << "######################" << endl; |
---|
43 |
debugOutput( DEBUG_LEVEL_NORMAL, "arg0 = %d, arg1 = 0x%08x\n" |
---|
44 |
, 1, 0xdeedbeef ); |
---|
45 |
cout << endl << endl; |
---|
46 |
|
---|
47 |
|
---|
48 |
cout << "###################" << endl; |
---|
49 |
cout << "### Test levels ###" << endl; |
---|
50 |
cout << "###################" << endl; |
---|
51 |
for ( debug_level_t level = DEBUG_LEVEL_VERBOSE; |
---|
52 |
level >= 0; |
---|
53 |
--level ) |
---|
54 |
{ |
---|
55 |
DebugModuleManager::instance()->setMgrDebugLevel( "Test", level ); |
---|
56 |
|
---|
57 |
cout << endl << "*** Debug Level = " << level << endl << endl; |
---|
58 |
|
---|
59 |
debugFatal( "fatal text\n" ); |
---|
60 |
debugError( "error text\n" ); |
---|
61 |
debugWarning( "warning text\n" ); |
---|
62 |
debugOutput( DEBUG_LEVEL_NORMAL, "normal output\n" ); |
---|
63 |
debugOutput( DEBUG_LEVEL_VERBOSE, "verbose output\n" ); |
---|
64 |
debugFatalShort( "fatal short text\n" ); |
---|
65 |
debugErrorShort( "error short text\n" ); |
---|
66 |
debugWarningShort( "warning short text\n" ); |
---|
67 |
debugOutputShort( DEBUG_LEVEL_NORMAL, "normal short output\n" ); |
---|
68 |
debugOutputShort( DEBUG_LEVEL_VERBOSE, "verbose short output\n" ); |
---|
69 |
} |
---|
70 |
cout << endl << endl; |
---|
71 |
|
---|
72 |
return true; |
---|
73 |
} |
---|
74 |
|
---|
75 |
DECLARE_DEBUG_MODULE; |
---|
76 |
}; |
---|
77 |
|
---|
78 |
IMPL_DEBUG_MODULE( Test, Test, DEBUG_LEVEL_VERBOSE ); |
---|
79 |
|
---|
80 |
DECLARE_GLOBAL_DEBUG_MODULE; |
---|
81 |
IMPL_GLOBAL_DEBUG_MODULE( Test, DEBUG_LEVEL_VERBOSE ); |
---|
82 |
|
---|
83 |
int main( int argc, char** argv ) |
---|
84 |
{ |
---|
85 |
cout << "#################################" << endl; |
---|
86 |
cout << "### Test global debug module ###" << endl; |
---|
87 |
cout << "#################################" << endl; |
---|
88 |
debugOutput( DEBUG_LEVEL_NORMAL, "foobar\n" ); |
---|
89 |
cout << endl << endl; |
---|
90 |
|
---|
91 |
Test test; |
---|
92 |
test.run(); |
---|
93 |
|
---|
94 |
return 0; |
---|
95 |
} |
---|
96 |
|
---|
97 |
/* |
---|
98 |
* Local variables: |
---|
99 |
* compile-command: "g++ -Wall -g -DDEBUG -o test test.cpp -L. -ldebugmodule" |
---|
100 |
* End: |
---|
101 |
*/ |
---|
102 |
|
---|