class BaseLoop: parameter test for dump and log command added.
This commit is contained in:
+13
-3
@@ -78,7 +78,7 @@ std::string BaseLoop::decodeMessage(const std::string& data)
|
||||
|
||||
case get:
|
||||
if (cmd.size() < 3) {
|
||||
result << "format: type class cmd [sub]";
|
||||
result << "format: get class cmd (sub)";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ std::string BaseLoop::decodeMessage(const std::string& data)
|
||||
|
||||
case set:
|
||||
if (cmd.size() != 4) {
|
||||
result << "format: type class cmd value";
|
||||
result << "format: set class cmd value";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ std::string BaseLoop::decodeMessage(const std::string& data)
|
||||
|
||||
case cyc:
|
||||
if (cmd.size() < 3) {
|
||||
result << "format: type class cmd [sub]";
|
||||
result << "format: cyc class cmd (sub)";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -200,12 +200,22 @@ std::string BaseLoop::decodeMessage(const std::string& data)
|
||||
break;
|
||||
|
||||
case dump:
|
||||
if (cmd.size() < 2) {
|
||||
result << "format: dump on|off";
|
||||
break;
|
||||
}
|
||||
|
||||
if (cmd[1] == "on") m_ebusloop->dump(true);
|
||||
if (cmd[1] == "off") m_ebusloop->dump(false);
|
||||
result << "done";
|
||||
break;
|
||||
|
||||
case log:
|
||||
if (cmd.size() < 2) {
|
||||
result << "format: log error|event|trace|debug";
|
||||
break;
|
||||
}
|
||||
|
||||
if (cmd[1] == "error") L.getSink(0)->setLevel(error);
|
||||
if (cmd[1] == "event") L.getSink(0)->setLevel(event);
|
||||
if (cmd[1] == "trace") L.getSink(0)->setLevel(trace);
|
||||
|
||||
+6
-6
@@ -84,11 +84,11 @@ void define_args()
|
||||
"\tlog file name (default: /var/log/ebus-daemon.log)",
|
||||
Appl::type_string, Appl::opt_mandatory);
|
||||
|
||||
A.addItem("p_area", Appl::Param(all), "", "logarea",
|
||||
A.addItem("p_logarea", Appl::Param(all), "", "logarea",
|
||||
"\tlogging area (bas=1, net=2, bus=4, cyc=8, default: all=15)",
|
||||
Appl::type_int, Appl::opt_mandatory);
|
||||
|
||||
A.addItem("p_level", Appl::Param(trace), "", "loglevel",
|
||||
A.addItem("p_loglevel", Appl::Param(trace), "", "loglevel",
|
||||
"\tlogging level (error=0, event=1, default: trace=2, debug=3)\n",
|
||||
Appl::type_int, Appl::opt_mandatory);
|
||||
|
||||
@@ -196,13 +196,13 @@ int main(int argc, char* argv[])
|
||||
|
||||
// make me Daemon
|
||||
if (A.getParam<bool>("p_foreground") == true) {
|
||||
L += new LogConsole(A.getParam<int>("p_area"),
|
||||
static_cast<const Level>(A.getParam<int>("p_level")),
|
||||
L += new LogConsole(A.getParam<int>("p_logarea"),
|
||||
static_cast<const Level>(A.getParam<int>("p_loglevel")),
|
||||
"logConsole");
|
||||
} else {
|
||||
D.run("/var/run/ebus-daemon.pid");
|
||||
L += new LogFile(A.getParam<int>("p_area"),
|
||||
static_cast<const Level>(A.getParam<int>("p_level")),
|
||||
L += new LogFile(A.getParam<int>("p_logarea"),
|
||||
static_cast<const Level>(A.getParam<int>("p_loglevel")),
|
||||
"logFile", A.getParam<const char*>("p_logfile"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user