Re: Message handling in/with ROOT

From: Mark Messier (messier@huhepl.harvard.edu)
Date: Tue Feb 01 2000 - 19:41:12 MET


Hi ROOTers,

I noticed that there is some interest in message services for ROOT. I just
completed (mostly!) work on a message handler for the MINOS experiment
and thought people might want to check it out. The interface looks like:

MSG("Pkg1", kDebug) << "This is a debugging message from package Pkg1\n";
MSG("Pkg2", kDebug) << "This is a debugging message from package Pkg2\n";

The features are:

- All messages have a package associated with them and a print threshold
  ("kVerbose,kDebug,kInfo,kWarning,kError, and kFatal)

- The threshold for printing messages can be set on a package-by-package
  level. For example I can lower the print threshold for Pkg1 without
  turning on the message from Pkg2 if I want to debug Pkg1 only.

- Each package can be connected to multiple output streams. For example,
  a message could optionally get sent to both cerr and a file errors.log.

- Messages can optionally have their priority, package name, file name
  and line number, CVS version and timestamp logged along with the
  mesagge. eg:

=E= Pkg 2000/02/01 13:14:48 testDemo.cxx:49 This is an ERROR message

- The output streams can be concatenated at the end of the job. This could
  be used, for example, if you wanted to automatically have all the
  kWarning, kError messages sorted by package in one file.

- The user can define "custom" output streams besides cout/cerr and
  files. For example, the GEANT4 streams G4cout and G4cerr can be defined
  and used this way.

- Performance is comparable to cout and cerr. Unprinted messages do not
  get formatted and are handled very quickly

Things on my "to do" list are:
(1) I'd like to have a "nice" interface that would take simple text
    commands and perform the necessary functions so that they don't have
    to be hard coded and could be set from a macro file
(2) The package uses STL (vector, list, and map) which limits the number
    of systems it will compile on. I have been reluctant to use the ROOT
    classes for these as I would like to use the system on code developed
    outside the ROOT framework.

If you want to try the code its at:

http://www.hepl.harvard.edu/~messier/software/msg-standalone.tar.gz

The Makefile is for Linux. Try "make tests" to build the test programs.
The program testDemo.cxx demonstrates how to use the service.

I'd appreciate comments and suggestions.

-Mark
========================================================================
Mark Messier                          e-mail: messier@huhepl.harvard.edu
Harvard University                  http://www.hepl.harvard.edu/~messier
42 Oxford Street                                     Tel. (617) 496-2361
Cambridge, MA 02138 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:18 MET