root/branches/streaming-rework/src/debugmodule/test_debugmodule.cpp

Revision 168, 2.1 kB (checked in by wagi, 18 years ago)

2006-03-04 Daniel Wagner <wagi@monom.org>

  • src/avdevice.cpp: Added 'verbose' argument to constructor
    and set debug level to DEBUG_LEVEL_VERBOSE if 'verbose'
    is true, e.g enables verbose mode with '-v' argument passed
    to test-freebob.
  • src/avdevice.h: Likewsise.
  • src/avdevicesubunit.cpp: Likewsise.
  • src/avdevicesubunit.h: Likewsise.
  • src/avplug.cpp: Likewsise.
  • src/avplug.h: Likewsise.
  • src/devicemanager.cpp: Likewsise.
  • src/debugmodule/debugmodule.cpp: Likewsise.
  • src/debugmodule/debugmodule.h: Likewsise.
  • src/debugmodule/test_debugmodule.cpp: Likewsise.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #include "debugmodule.h"
2
3 #include <iostream>
4
5 using namespace std;
6
7 class Test
8 {
9 public:
10     Test()
11         {}
12     ~Test()
13         {}
14
15     bool run() {
16         cout << "######################" << endl;
17         cout << "### Test arguments ###" << endl;
18         cout << "######################" << endl;
19         debugOutput( DEBUG_LEVEL_NORMAL, "arg0 = %d, arg1 = 0x%08x\n"
20                      , 1, 0xdeedbeef );
21         cout << endl << endl;
22
23
24         cout << "###################" << endl;
25         cout << "### Test levels ###" << endl;
26         cout << "###################" << endl;
27         for ( debug_level_t level = DEBUG_LEVEL_VERBOSE;
28               level >= 0;
29               --level )
30         {
31             DebugModuleManager::instance()->setMgrDebugLevel( "Test", level );
32
33             cout << endl << "*** Debug Level = " << level << endl << endl;
34
35             debugFatal( "fatal text\n" );
36             debugError( "error text\n" );
37             debugWarning( "warning text\n" );
38             debugOutput( DEBUG_LEVEL_NORMAL, "normal output\n" );
39             debugOutput( DEBUG_LEVEL_VERBOSE,  "verbose output\n" );
40             debugFatalShort( "fatal short text\n" );
41             debugErrorShort( "error short text\n" );
42             debugWarningShort( "warning short text\n" );
43             debugOutputShort( DEBUG_LEVEL_NORMAL, "normal short output\n" );
44             debugOutputShort( DEBUG_LEVEL_VERBOSE,  "verbose short output\n" );
45         }
46         cout << endl << endl;
47
48         return true;
49     }
50
51     DECLARE_DEBUG_MODULE;
52 };
53
54 IMPL_DEBUG_MODULE( Test, Test, DEBUG_LEVEL_VERBOSE );
55
56 DECLARE_GLOBAL_DEBUG_MODULE;
57 IMPL_GLOBAL_DEBUG_MODULE( Test, DEBUG_LEVEL_VERBOSE );
58
59 int main( int argc, char** argv )
60 {
61     cout << "#################################" << endl;
62     cout << "### Test global debug module  ###" << endl;
63     cout << "#################################" << endl;
64     debugOutput( DEBUG_LEVEL_NORMAL, "foobar\n" );
65     cout << endl << endl;
66
67     Test test;
68     test.run();
69
70     return 0;
71 }
72
73 /*
74  * Local variables:
75  *  compile-command: "g++ -Wall -g -DDEBUG -o test test.cpp -L. -ldebugmodule"
76  * End:
77  */
78
Note: See TracBrowser for help on using the browser.