10 #ifndef SRC_INCLUDE_SMASH_LOGGING_H_
11 #define SRC_INCLUDE_SMASH_LOGGING_H_
16 #include <yaml-cpp/yaml.h>
168 #define DECLARE_LOGAREA(id__, name__) \
170 static constexpr int id = id__; \
171 static constexpr const char *textual() { return #name__; } \
172 static constexpr int textual_length() { return sizeof(#name__) - 1; } \
243 #define SMASH_SOURCE_LOCATION \
244 __FILE__ ":" + std::to_string(__LINE__) + " (" + __func__ + ')'
264 template <
typename T>
282 out << std::setfill(
' ') << std::setw(h.
width);
289 out <<
' ' << h.
unit;
306 template <
typename T>
308 int precision = -1) {
309 return {value, width, precision, unit};
316 extern std::array<einhard::Logger<>, std::tuple_size<LogArea::AreaTuple>::value>
346 if (!node.IsScalar()) {
Interface to the SMASH configuration files.
This is the main include file for Einhard.
Sampling
Possible methods of impact parameter sampling.
const T & value
Value that is being formatted.
const int width
Output width.
const char *const unit
Unit that is attached at the end of value.
#define DECLARE_LOGAREA(id__, name__)
Declares the necessary interface to identify a new log area.
std::tuple< Main, Experiment, Box, Collider, Sphere, Action, InputParser, ParticleType, FindScatter, Clock, DecayModes, Resonances, ScatterAction, Distributions, Propagation, Grid, List, Nucleus, Density, PauliBlocking, Tmn, Fpe, Lattice, Sampling, Pythia, GrandcanThermalizer, CrossSections, Output, HadronGasEos, HyperSurfaceCrossing, InitialConditions, ScatterActionMulti > AreaTuple
This type collects all existing log areas so they will be created with the correct log level automati...
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
void set_default_loglevel(einhard::LogLevel level)
Set the default log level (what will be returned from subsequent default_loglevel calls).
static bool decode(const Node &node, einhard::LogLevel &x)
Convert from YAML::Node to einhard::LogLevel.
const int precision
Precision that value is being formatted with.
friend std::ostream & operator<<(std::ostream &out, const FormattingHelper &h)
Nicely formatted output.
static Node encode(const einhard::LogLevel &x)
Convert from einhard::LogLevel to YAML::Node.
FormattingHelper< T > format(const T &value, const char *unit, int width=-1, int precision=-1)
Acts as a stream modifier for std::ostream to output an object with an optional suffix string and wit...
einhard::LogLevel default_loglevel()
void create_all_loggers(Configuration config)
Called from main() right after the Configuration object is fully set up to create all logger objects ...
This namespace contains all objects required for logging using Einhard.
LogLevel getLogLevel(const std::string &level)
Compares the string level against the strings for LogLevel and returns the one it matches.
LogLevel
Specification of the message severity.
const char * getLogLevelString() noexcept
Retrieve a human readable representation of the given log level value.
Convert from YAML::Node to SMASH-readable (C++) format and vice versa.