Socket/Protocols/INet: Extend INet6SocketAddress syntax to support more flexible...
[senf.git] / Console / testServer.cc
index 70b8d34..429d959 100644 (file)
@@ -69,27 +69,47 @@ void shutdownServer()
     throw senf::console::Executor::ExitException();
 }
 
+void enableLogging(std::ostream & os)
+{
+    senf::console::Client::get(os).route<senf::log::NOTICE>();
+}
+
 int main(int, char **)
 {
     ::signal(SIGPIPE, SIG_IGN);
-    senf::log::ConsoleTarget::instance().route< senf::SenfLog, senf::log::NOTICE >();
+    senf::log::ConsoleTarget::instance().route< senf::log::VERBOSE >();
 
     senf::console::root()
         .doc("This is the console test application");
+
     senf::console::root()
-        .mkdir("test")
-        .doc("Network related settings");
+        .mkdir("console")
+        .doc("Console settings");
+
+    senf::console::DirectoryNode & serverDir (
+        senf::console::root()
+            .mkdir("server")
+            .doc("server commands") );
+
+    senf::console::ScopedDirectory<> testDir;
     senf::console::root()
-        .mkdir("server");
-    senf::console::root()["server"]
+        .add("test", testDir)
+        .doc("Test functions");
+
+    senf::console::root()["console"]
+        .add("showlog", &enableLogging)
+        .doc("Enable display of log messages on the current console");
+
+    serverDir
         .add("shutdown", &shutdownServer)
         .doc("Terminate server application");
-    senf::console::root()["test"]
+
+    testDir
         .add("echo", &echo)
         .doc("Example of a function utilizing manual argument parsing");
 
     TestObject test;
-    senf::console::root()
+    testDir
         .add("testob", test.dir)
         .doc("Example of an instance directory");