change NS_LOG= syntax and default behavior to be more useful by default.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 14 Apr 2008 16:39:26 -0700
changeset 2982 a7e3e54c7e94
parent 2981 982a6f364d2c
child 2983 e3a416fe9dd5
change NS_LOG= syntax and default behavior to be more useful by default.
src/core/log.cc
src/core/log.h
--- a/src/core/log.cc	Mon Apr 14 12:21:24 2008 -0700
+++ b/src/core/log.cc	Mon Apr 14 16:39:26 2008 -0700
@@ -67,7 +67,7 @@
   std::string::size_type next = 0;
   while (next != std::string::npos)
     {
-      next = env.find_first_of (";", cur);
+      next = env.find_first_of (":", cur);
       std::string tmp = std::string (env, cur, next-cur);
       if (tmp == "print-list")
         {
@@ -115,7 +115,7 @@
   std::string::size_type next = 0;
   while (next != std::string::npos)
     {
-      next = env.find_first_of (";", cur);
+      next = env.find_first_of (":", cur);
       std::string tmp = std::string (env, cur, next-cur);
       std::string::size_type equal = tmp.find ("=");
       std::string component;
@@ -124,7 +124,8 @@
           component = tmp;
           if (component == myName || component == "*")
             {
-              Enable (LOG_DEBUG);
+              int level = LOG_ALL | LOG_PREFIX_TIME | LOG_PREFIX_FUNC;
+              Enable ((enum LogLevel)level);
               return;
             }
         }
--- a/src/core/log.h	Mon Apr 14 12:21:24 2008 -0700
+++ b/src/core/log.h	Mon Apr 14 16:39:26 2008 -0700
@@ -38,16 +38,16 @@
  * messages, use the ns3::LogComponentEnable
  * function or use the NS_LOG environment variable 
  *
- * Use the environment variable NS_LOG to define a ';'-separated list of
+ * Use the environment variable NS_LOG to define a ':'-separated list of
  * logging components to enable. For example (using bash syntax), 
  * NS_LOG="OlsrAgent" would enable one component; 
- * NS_LOG="OlsrAgent;Ipv4L3Protocol" would enable two
- * components, etc.  NS_LOG="*" will enable all available log components.
- * For each component, the "debug" log level is enabled by default.
+ * NS_LOG="OlsrAgent:Ipv4L3Protocol" would enable two
+ * components, etc.  NS_LOG="*" will enable all available log components at
+ * all levels.
  *
  * To obtain more components than just debug log level, more components 
  * can be enabled selectively with the following
- * syntax: NS_LOG='Component1=func|param|warn;Component2=error|debug'
+ * syntax: NS_LOG='Component1=func|param|warn:Component2=error|debug'
  * This example would enable the 'func', 'param', and 'warn' log
  * levels for 'Component1' and the 'error' and 'debug' log levels
  * for 'Component2'.  The wildcard can be used here as well.  For example