Simulate provides an API which can be used to log messages from simulation execution. Applications using the logging API need to include the aether/common/logging.hh header.

Windows Support

At present the logging API is not functional under Windows and should only be included and used inside simulation code. Any Windows code should define the C pre-processor macro WITHOUT_HADEAN_LOGGING before including Simulate headers, because uses of the logging API may be pulled in transitively.


Executables using the logging API must initialise it before any messages can be logged. This can be done with a call to aether::log::init():
aether::log::init(process_name, process_pid);
process_name should be a short string to help identify the process. process_pid is a value of type uint64_t which is expected to be a process identifier. Hadean PIDs can be cast to uint64_t to supply this value. Neither process_name nor process_pid are required to be meaningful.
Calling this function just after hadean::init() is recommended.

Setting a Logging Level

The logging level can be set via a call to aether::log::set_level() as follows;
Only messages equal to or above the specified level will be logged. :
The following levels are defined in the scope of aether::log::level
  • INFO
  • WARN
In the provided demos Simulate sets the logging level for all processes in the simulation to the one specified in the aether::arguments instance used to construct the octree.

Logging Messages

There are two ways to log messages. The first is capable of printing any C++ type that provides a C++ streaming operator.
const int n = 42;
const std::string s = "Hello world!";
AETHER_LOG(INFO)("The value of n is ", n, " and the value of s is ", s);
The second allows the use of printf style format strings:
cosnt int n = 42;
const std::string s = "Hello world!";
AETHER_LOG(INFO).printf("The value of n is %i and the value of s is %s", n, s.c_str();