Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/VecGeom/management/README.md is written in an unsupported language. File is not indexed.

0001 # Management utilities
0002 
0003 ## Logging
0004 
0005 The `VECGEOM_LOG` macro creates a temporary object that sends the message to an
0006 output handle, which by default prints with color to `std::clog` (which is
0007 like `cerr` but with buffering).
0008 
0009 The logger can be manually invoked using the `vecgeom::logger()` global
0010 function. Its "call" operator takes the "Provenance" (file + line, or possibly
0011 error code) and log level, and it returns the temporary object that will write
0012 to output upon destruction.
0013 
0014 The log levels should have particular meanings for consistency:
0015 
0016 =========== =============================================================
0017 Level       Description
0018 =========== =============================================================
0019 debug       Debugging messages
0020 diagnostic  Diagnostics about current program execution
0021 status      Program execution status (what stage is beginning)
0022 info        Important informational messages
0023 warning     Warnings about unusual events
0024 error       Something went wrong, but execution can continue
0025 critical    Something went terribly wrong: program should probably abort
0026 =========== =============================================================
0027 
0028 The `VECGEOM_LOG` environment variable, when set to one of these values,
0029 determines the default output level, which by default is "status".
0030 
0031 ## Color output
0032 
0033 The `vecgeom::color_code` function returns an ANSI string that can be used to
0034 change the terminal's color and style. The `VECGEOM_COLOR` or `GTEST_COLOR`
0035 environment variables can be used to explicitly enable or disable (by setting
0036 to 1 or 0). The default ability to print color is determined by checking
0037 whether the stderr stream is sent to the screen, and whether the `TERM`
0038 environment variable is in the xterm family.
0039 
0040 ```c++
0041 // Print a message in red
0042 cerr << color_code('r') << "I'm angry!" << color_code(' ') << '\n'
0043      << "...and I'm normal\n";
0044 ```
0045 
0046 ## Environment variables
0047 
0048 The `vecgeom::getenv` function provides thread-safe access to environment
0049 variables. The map of variables that have been accessed at runtime is available
0050 by interrogating `vecgeom::environment()`.