|
Celeritas 0.7.0-dev.194+develop.0df4cab59
|
Create a log message to be printed based on output/verbosity settings. More...
#include <Logger.hh>
Public Types | |
Type aliases | |
| using | Message = detail::LoggerMessage |
Public Member Functions | |
| Logger (LogHandler &&handle) | |
| Construct with handler. | |
| Message | operator() (LogProvenance &&prov, LogLevel lev) const |
| Create a logger that flushes its contents when it destructs. | |
| void | level (LogLevel lev) |
| Set the minimum logging verbosity. | |
| LogLevel | level () const |
| Get the current logging verbosity. | |
| LogHandler const & | handle () const |
| Access the log handle. | |
| LogHandler & | handle () |
| Access the log handle (mutable, try to avoid using?) | |
Static Public Member Functions | |
| static constexpr LogLevel | default_level () |
| Get the default log level. | |
| static Logger | from_handle_env (LogHandler &&handle, std::string const &key) |
| Create a logger from a handle and level environment variable. | |
Create a log message to be printed based on output/verbosity settings.
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.
spdlog to reduce maintenance burden and improve flexibility.
|
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.