equal
deleted
inserted
replaced
1 /***************************************************************************** |
|
2 * |
|
3 * $Id$ |
|
4 * |
|
5 ****************************************************************************/ |
|
6 |
|
7 #include <sstream> |
|
8 #include <iomanip> |
|
9 using namespace std; |
|
10 |
|
11 #include "globals.h" |
|
12 |
|
13 /*****************************************************************************/ |
|
14 |
|
15 const char *help_debug = |
|
16 "<LEVEL>\n" |
|
17 "\n" |
|
18 "Set the master debug level.\n" |
|
19 "\n" |
|
20 "Debug messages are printed to syslog.\n" |
|
21 "\n" |
|
22 "Arguments:\n" |
|
23 " LEVEL can have one of the following values:\n" |
|
24 " 0 for no debugging output,\n" |
|
25 " 1 for some debug messages, or\n" |
|
26 " 2 for printing all frame contents (use with caution!).\n" |
|
27 "\n" |
|
28 "Numerical values can be specified either with decimal (no prefix),\n" |
|
29 "octal (prefix '0') or hexadecimal (prefix '0x') base.\n"; |
|
30 |
|
31 /****************************************************************************/ |
|
32 |
|
33 void command_debug(void) |
|
34 { |
|
35 stringstream str; |
|
36 int debugLevel; |
|
37 |
|
38 if (commandArgs.size() != 1) { |
|
39 stringstream err; |
|
40 err << "'" << commandName << "' takes exactly one argument!"; |
|
41 throw InvalidUsageException(err); |
|
42 } |
|
43 |
|
44 str << commandArgs[0]; |
|
45 str >> resetiosflags(ios::basefield) // guess base from prefix |
|
46 >> debugLevel; |
|
47 |
|
48 if (str.fail()) { |
|
49 stringstream err; |
|
50 err << "Invalid debug level '" << commandArgs[0] << "'!"; |
|
51 throw InvalidUsageException(err); |
|
52 } |
|
53 |
|
54 masterDev.open(MasterDevice::ReadWrite); |
|
55 masterDev.setDebug(debugLevel); |
|
56 } |
|
57 |
|
58 /*****************************************************************************/ |
|