Celeritas
0.5.0-56+6b053cd
|
Create a log message to be printed based on output/verbosity sttings. More...
#include <Logger.hh>
Public Types | |
Type aliases | |
using | Message = detail::LoggerMessage |
Public Member Functions | |
Logger (LogHandler handle) | |
Construct with handler. More... | |
Message | operator() (LogProvenance &&prov, LogLevel lev) |
Create a logger that flushes its contents when it destructs. More... | |
void | level (LogLevel lev) |
Set the minimum logging verbosity. | |
LogLevel | level () const |
Get the current logging verbosity. | |
Static Public Member Functions | |
static constexpr LogLevel | default_level () |
Get the default log level. | |
Create a log message to be printed based on output/verbosity sttings.
This should generally be called by the world_logger
and self_logger
functions below. The call operator()
returns an object that should be streamed into in order to create a log message.
This object is assignable, so to replace the default log handler with a different one, you can call
When using with MPI, the world_logger
global objects are different on each process: rank 0 will have a handler that outputs to screen, and the other ranks will have a "null" handler that suppresses all log output.
|
explicit |
Construct with handler.
A null handler will silence the logger.
|
inline |
Create a logger that flushes its contents when it destructs.
It's assumed that log messages will be relatively unlikely (and expensive anyway), so we mark as CELER_UNLIKELY
to optimize for the no-logging case.