[mathicgb] 184/393: Improved the help system's description of logging.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Fri Apr 3 15:58:57 UTC 2015


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch upstream
in repository mathicgb.

commit 8872c00934ba05887276f411d140e2f24ce19ab2
Author: Bjarke Hammersholt Roune <bjarkehr.code at gmail.com>
Date:   Thu Mar 7 12:33:19 2013 +0100

    Improved the help system's description of logging.
---
 src/cli/HelpAction.cpp     | 56 ++++++++++++++++++++++++++++++++++++++--------
 src/mathicgb/LogDomain.hpp |  3 ++-
 2 files changed, 49 insertions(+), 10 deletions(-)

diff --git a/src/cli/HelpAction.cpp b/src/cli/HelpAction.cpp
index 9c5c2a7..b9c610b 100755
--- a/src/cli/HelpAction.cpp
+++ b/src/cli/HelpAction.cpp
@@ -1,20 +1,58 @@
-#include "mathicgb/stdinc.h"
-#include "HelpAction.hpp"
-
-#include "mathicgb/LogDomain.hpp"
-#include "mathicgb/LogDomainSet.hpp"
-
-#include <iostream>
-
+#include "mathicgb/stdinc.h"
+#include "HelpAction.hpp"
+
+#include "mathicgb/LogDomain.hpp"
+#include "mathicgb/LogDomainSet.hpp"
+
+#include <iostream>
+
 void HelpAction::performAction() {
   if (topic() != "logs") {
     mathic::HelpAction::performAction();
     return;
   }
 
+  const char* header =
+    "MathicGB offers a set of logs that can be enabled or disabled "
+    "individually.\n"
+    "\n"
+    "A log can have a streaming component and a summary "
+    "component. The streaming component is printed as the logged event "
+    "occurs while the summary component is printed at the end. For example "
+    "a log for opening files would stream a message every time a file is "
+    "opened and it would report the total number of files opened when the "
+    "program has run to the end. The summary can also include how long "
+    "something took.\n"
+    "\n"
+    "An enabled log always prints its summary if it registered any events. "
+    "The streaming component can be turned off even for an enabled log, and "
+    "this is the default for some logs.\n"
+    "\n"
+    "You specify the log configuration using the option -log X, where X is "
+    "a comma-seperated list of log specifications. Here is an example:\n"
+    "\n"
+    "    A,+B,-C,D+,E-\n"
+    "\n"
+    "This enables logs A, B, D and E and disables C. Furthermore, streaming "
+    "for D is turned on while it is turned off for E. The streaming setting "
+    "for A, B and C is the default for those logs.\n"
+    "\n"
+    "A prefix of - disables the log while no prefix or a prefix of + enables "
+    "it. A suffix of - turns off streaming while a suffix of + turns it on. "
+    "If there is no suffix then the setting for streaming is unchanged.\n"
+    "\n"
+    "The following is a list of all compile-time enabled logs. The prefixes "
+    "and suffixes indicate the default state of the log.\n";
+  mathic::display(header);
   auto& logs = LogDomainSet::singleton().logDomains();
   for (auto it = logs.begin(); it != logs.end(); ++it) {
-    std::cout << "\n " << (*it)->name() << '\n';
+    const auto toSign = [](const bool b) {return b ? '+' : '-';};
+    std::cerr
+      << "\n "
+      << toSign((*it)->enabled())
+      << (*it)->name()
+      << toSign((*it)->streamEnabledPure())
+      << '\n';
     mathic::display((*it)->description(), "   ");
   }
 }
diff --git a/src/mathicgb/LogDomain.hpp b/src/mathicgb/LogDomain.hpp
index 57cd0bb..a927923 100755
--- a/src/mathicgb/LogDomain.hpp
+++ b/src/mathicgb/LogDomain.hpp
@@ -40,7 +40,8 @@ public:
   const char* name() const {return mName;}
   const char* description() const {return mDescription;}
   bool enabled() const {return mEnabled;}
-  bool streamEnabled() const {return enabled() && mStreamEnabled;}
+  bool streamEnabledPure() const {return mStreamEnabled;}
+  bool streamEnabled() const {return enabled() && streamEnabledPure();}
 
   void setEnabled(const bool enabled) {mEnabled = enabled;}
   void setStreamEnabled(const bool enabled) {mStreamEnabled = enabled;}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mathicgb.git



More information about the debian-science-commits mailing list