Hi,

I improved the logging of cxxtools today. There are 2 new features. Now 
it is possible to switch individual log levels individually on and of. 
And there are new log levels.

Previously it was possible to enable all log statement of a category up 
to a level, e.g. setting the log level to INFO enabled FATAL, ERROR and 
WARN also but no DEBUG or TRACE.

Sometimes I encountered a problem that I just want to know when a method 
was entered and exited but not really in detail, what happens there. So 
I needed to enable TRACE but this enabled all other levels also. The 
first idea was to change TRACE to a flag, so that it can be added to the 
existing log level. To enable it should be possible to set the log level 
e.g. to TINFO, which is INFO but with trace enabled.

But when I started to implement it, I saw, that it is quite straight 
forward to change all levels to just flags. So I can enable e.g. INFO 
and ERROR and disable others.

So now there are several ways to configure the log level:
  * FATAL, ERROR, WARN, INFO, DEBUG or TRACE: they work like before
  * TFATAL, TERROR ...: they add the TRACE to the log level
  * FATAL|INFO|TRACE: enable just those log levels and disable the others
  * |INFO: enable just INFO and nothing else

The other feature introduces new log levels. I did Java development the 
last 9 months (but I'm back in the C++ world now) and there I learned 
about the logging framework there. Instead of a single debug level there 
are 3: fine, finer and finest. And now in cxxtools there are also those 
3. There are 3 new log macros log_fine, log_finer and log_finest, which 
output log in those new levels. log_debug is the same as log_fine. This 
gives us the chance to be more granular, how much logging we need.

Note that since some months it is also possible to reinitialize logging 
whenever you need. So in a long running process you can implement some 
external signaling to reread the logging configuration at runtime to 
increase or decrease logging. Just as a side note: it is not allowed to 
do it in a signal handler as almost nothing is allowed in a signal handler.

And no - it is not yet documented anywhere else than here.


Tommi

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general

Reply via email to