Celeritas 0.7.0-dev.275+develop.cfe230fd
Loading...
Searching...
No Matches
Classes | Macros | Functions
Logger.hh File Reference
#include <utility>
#include "corecel/Macros.hh"
#include "LoggerTypes.hh"
#include "detail/LoggerMessage.hh"

Classes

class  celeritas::Logger
 Create a log message to be printed based on output/verbosity settings. More...
 

Macros

#define CELER_CODE_PROVENANCE
 Inject the source code provenance (current file and line)
 
#define CELER_LOG(LEVEL)
 Return a LogMessage object for streaming into at the given level.
 
#define CELER_LOG_LOCAL(LEVEL)
 Like CELER_LOG but for code paths that may only happen on a single process or thread.
 

Functions

Loggerceleritas::world_logger ()
 App-level logger: print only on "main" process.
 
Loggerceleritas::self_logger ()
 Serial logger: print on every process that calls it.
 

Macro Definition Documentation

◆ CELER_CODE_PROVENANCE

#define CELER_CODE_PROVENANCE
Value:
{ \
__FILE__, __LINE__ \
}
Origin of a log message.
Definition LoggerTypes.hh:37

Inject the source code provenance (current file and line)

◆ CELER_LOG

#define CELER_LOG (   LEVEL)
Value:
::celeritas::world_logger()(CELER_CODE_PROVENANCE, \
::celeritas::LogLevel::LEVEL)
#define CELER_CODE_PROVENANCE
Inject the source code provenance (current file and line)
Definition corecel/io/Logger.hh:24

Return a LogMessage object for streaming into at the given level.

The regular CELER_LOG call is for code paths that happen uniformly in parallel, approximately the same message from every thread and task.

The logger will only format and print messages. It is not responsible for cleaning up the state or exiting an app.

CELER_LOG(debug) << "Don't print this in general";
CELER_LOG(warning) << "You may want to reconsider your life choices";
CELER_LOG(critical) << "Caught a fatal exception: " << e.what();
#define CELER_LOG(LEVEL)
Return a LogMessage object for streaming into at the given level.
Definition corecel/io/Logger.hh:46

◆ CELER_LOG_LOCAL

#define CELER_LOG_LOCAL (   LEVEL)
Value:
::celeritas::self_logger()(CELER_CODE_PROVENANCE, \
::celeritas::LogLevel::LEVEL)

Like CELER_LOG but for code paths that may only happen on a single process or thread.

Use sparingly because this can be very verbose. This should be used for error messages from an event or track at runtime.

Function Documentation

◆ self_logger()

Logger & celeritas::self_logger ( )

Serial logger: print on every process that calls it.

Setting the "CELER_LOG_LOCAL" environment variable to "debug", "info", "error", etc. will change the default log level.

See also
CELER_LOG_LOCAL .

◆ world_logger()

Logger & celeritas::world_logger ( )

App-level logger: print only on "main" process.

Setting the "CELER_LOG" environment variable to "debug", "info", "error", etc. will change the default log level.

See also
CELER_LOG .