Skip to content

Add logger from Celeritas

Seth Johnson requested to merge celer-log into master

This imports (and namespaces as VecGeom) the logging utilities from Celeritas.

The logger is called with the VECGEOM_LOG macro and an argument that sets the verbosity level (see LoggerTypes.h):

VECGEOM_LOG(warning) << "The value of the doodad " << x << " is inconsistent";

The log level can be adjusted globally by default using the VECGEOM_LOG environment variable or by calling:

vecgeom::logger().set_level(vecgeom::LogLevel::warning);

which will hide all debug, informational, and warning messages.

Log objects can also be manually created; they will be flushed to the output stream upon destruction:

{
    auto msg = vecgeom::logger()({"Geom", 2}, vecgeom::LogLevel::warning);
    msg << "Here's a line";
    msg << " (OK that's it)";
}

All messages have a single newline appended to them before printing to screen.

Additional support utilities:

  • Environment for managing environment variables
  • ColorUtils for adding colors (disable by setting VECGEOM_COLOR=0)
Edited by Seth Johnson

Merge request reports