10 #ifndef SRC_INCLUDE_SMASH_LOGGING_H_
11 #define SRC_INCLUDE_SMASH_LOGGING_H_
17 #include "yaml-cpp/yaml.h"
75 #define DECLARE_LOGAREA(id__, name__) \
77 static constexpr int id = id__; \
78 static constexpr const char *textual() { return #name__; } \
79 static constexpr int textual_length() { return sizeof(#name__) - 1; } \
153 #define SMASH_SOURCE_LOCATION \
154 __FILE__ ":" + std::to_string(__LINE__) + " (" + __func__ + ')'
174 template <
typename T>
192 out << std::setfill(
' ') << std::setw(h.
width);
199 out <<
' ' << h.
unit;
216 template <
typename T>
218 int precision = -1) {
219 return {value, width, precision, unit};
226 extern std::array<einhard::Logger<>, std::tuple_size<LogArea::AreaTuple>::value>
256 if (!node.IsScalar()) {
Interface to the SMASH configuration files.
This is the main include file for Einhard.
const T & value
Value that is being formatted.
const int width
Output width.
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, Pythia, GrandcanThermalizer, CrossSections, Output, HyperSurfaceCrossing, InitialConditions, ScatterActionMulti, Configuration, Potentials, RootSolver > AreaTuple
This type collects all existing log areas so they will be created with the correct log level automati...
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::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.