Skip to content

WIP: Prototype of a new interface for logging

Marco Clemencic requested to merge clemenci/Gaudi:new-logging-interface into master

I started playing with the concept I mentioned at the workshop (was it there?).

Here are a few examples of usage (from Logging test):

void MyStuff::exec() const {
    print( "entering exec()" );
    info( "plain string" );
    info( []() -> std::string { return "function without arguments"; } );
    info( []( int i ) -> std::string { return "function with " + std::to_string( i ) + " arguments"; }, 1 );
    info( Gaudi::Logging::Streamer, "we can use streamers with modifiers: 0x", std::hex, std::setw( 4 ),
          std::setfill( '0' ), 42 );
    warning( "and this is a warning" );
    info<C_Rulez>( "a printf %s: %-10.3f", "example", 123.45 );
    info( "what\nabout\nmulti\nline?" );
}

which produces:

instance-1           ALWAYS  entering exec()
instance-1           INFO    plain string
instance-1           INFO    function without arguments
instance-1           INFO    function with 1 arguments
instance-1           INFO    we can use streamers with modifiers: 0x002a
instance-1           WARNING and this is a warning
instance-1           INFO    a printf example: 123.450
instance-1           INFO    what
instance-1           INFO    about
instance-1           INFO    multi
instance-1           INFO    line?

To Do:

  • integration with the rest of the framework
  • define what to pass to the backend (i.e. just the final string or a log context and the formatted message?)
  • documentation and (proper) examples

Note: includes !577 (merged) and !756 (merged)

Edited by Marco Clemencic

Merge request reports