10 #ifndef SRC_INCLUDE_LOGGING_H_ 11 #define SRC_INCLUDE_LOGGING_H_ 16 #include <yaml-cpp/yaml.h> 160 #define DECLARE_LOGAREA(id__, name__) \ 162 static constexpr int id = id__; \ 163 static constexpr const char *textual() { return #name__; } \ 164 static constexpr int textual_length() { return sizeof(#name__) - 1; } \ 240 template <
typename LogAreaTag>
242 static_assert(LogAreaTag::id < std::tuple_size<LogArea::AreaTuple>::value &&
244 "The LogArea::AreaTuple is out of sync with the declared log " 245 "areas. Please fix! (see top of 'include/logging.h')");
253 #define source_location \ 254 __FILE__ ":" + std::to_string(__LINE__) + " (" + __func__ + ')' 274 template <
typename T>
292 out << std::setfill(
' ') << std::setw(h.
width);
299 out <<
' ' << h.
unit;
316 template <
typename T>
318 int precision = -1) {
319 return {value, width, precision, unit};
349 if (!node.IsScalar()) {
361 #endif // SRC_INCLUDE_LOGGING_H_ 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...
const T & value
Value that is being formatted.
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 > AreaTuple
This type collects all existing log areas so they will be created with the correct log level automati...
friend std::ostream & operator<<(std::ostream &out, const FormattingHelper &h)
Nicely formatted output.
static bool decode(const Node &node, einhard::LogLevel &x)
Convert from YAML::Node to einhard::LogLevel.
static Node encode(const einhard::LogLevel &x)
Convert from einhard::LogLevel to YAML::Node.
const int precision
Precision that value is being formatted with.
Interface to the SMASH configuration files.
Convert from YAML::Node to SMASH-readable (C++) format and vice versa.
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 ...
#define DECLARE_LOGAREA(id__, name__)
Declares the necessary interface to identify a new log area.
const char * getLogLevelString() noexcept
Retrieve a human readable representation of the given log level value.
This is the main include file for Einhard.
This namespace contains all objects required for logging using Einhard.
A Logger object can be used to output messages to stdout.
void set_default_loglevel(einhard::LogLevel level)
Set the default log level (what will be returned from subsequent default_loglevel calls)...
const char *const unit
Unit that is attached at the end of value.
Sampling
Possible methods of impact parameter sampling.
einhard::Logger & retrieve_logger_impl(int id)
const int width
Output width.
LogLevel
Specification of the message severity.
LogLevel getLogLevel(const std::string &level)
Compares the string level against the strings for LogLevel and returns the one it matches...
einhard::Logger & logger()