Linear Collider Forum



Home » Software Tools » Marlin et al » marlin::message
marlin::message [message #851] Tue, 15 May 2007 03:16 Go to next message
harderk
Messages: 42
Registered: March 2004
Location: RAL
Hello everyone,
I wonder whether it wouldn't be a good idea to add a message level FATAL to marlin::message that would immediately halt the program after logging the associated message text.
This seems more consistent than using exceptions for the really
bad errors and marlin::message for the not quite so bad errors.
In fact, you could probably get the best of both worlds by having
marlin::message trigger an exception when being invoked with message level FATAL.
Any opinions?
Kristian

Re: marlin::message [message #1739 is a reply to message #851] Tue, 12 May 2009 04:52 Go to previous messageGo to next message
oschaefer
Messages: 23
Registered: September 2007
Location: University of Rostock / D...
Now I searched for exceptions in the forum and found this article:
I think that's a sensible idea. However, the reader of the code might not be aware, that a streamlog_out(FATAL) will cause a program abort.
On the other hand the consequences of a streamlog_out are not handled consistently, such that in one processor it is embedded in a try catch block and in the next one it will be merely printed and probably just vanish in the output of all the processors.

In addition it might be a good idea to enable color coded terminal output for the different levels.

Just now, where I try to redesign my processors consistently it is very hard to decide for a sensible strategy, as all the try statements don't enhance readability, streamlogs do nothing but potentially inform the user, and who knows how many other techniques are being used.

Maybe additional functions like:

terminateProgramWithError(string errorText);
continueWithNextEvent(...);
skipProcessingEvent(...);

and the like would allow to express in a more compact form what happens and to steer the processor chain to a certain extend from within the processors?
Re: marlin::message [message #1775 is a reply to message #851] Wed, 01 July 2009 08:31 Go to previous message
gaede
Messages: 233
Registered: January 2004
Location: DESY, Hamburg
Hi,

there are already exceptions defined to skip further processing of the current events or to 'gracefully' stop the event processing entirely. The first will continue with processing the next event and the latter will call Processor::end() for all processors in order to clean up allocagted resource, eg. write histo files etc.

So in any processor you can do sth like:

 if( .. skip condition ...){
    streamlog_out( MESSAGE ) << " skiping event coz' ..." <<    endl;
    throw SkipEventException( this ) ;

 }


 if( ... error condition ...){

   streamlog_out( ERROR ) << " sth bad happened ..." << endl ;
   throw StopProcessingException( this ) ;
 }




Frank.
Previous Topic:Command line arguments "to" MARLIN Steeringfiles
Next Topic:MarlinReco example
Goto Forum:
  

[ PDF ]

Current Time: Sun Sep 22 17:28:40 Pacific Daylight Time 2019
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.1.
Copyright ©2001-2010 FUDforum Bulletin Board Software