iterative-solver 0.0
molpro::linalg::itsolv::Logger Struct Reference

A dummy structured logger. More...

#include <Logger.h>

Detailed Description

A dummy structured logger.

This should be replaced by a fully functional logger from Profiler or similar.

The log output is structured using JSON or HTML format for easy parsing. Logging is split into sections

//Log output
{ // some initial state attributes
Log = [
{SectionName = "Section1",
Log = [
{SectionName = "Section1Child1"},
Log = [{ date = "year-mm-dd-hh:mm:ss", msg="log message", custom_entry_name="DataDump"}
,{ date = "...", msg="another message"}
]
]
}
,{SectionName = "Section2"
}
]
}
void msg(const std::string &message, Level log_lvl)
Definition: Logger.cpp:16

The logger also handles output which might go to a separate stream.

Public Types

enum  Level : short {
  None ,
  Trace ,
  Debug ,
  Info ,
  Warn ,
  Error ,
  Fatal
}
 Different levels of logging. More...
 

Public Member Functions

void msg (const std::string &message, Level log_lvl)
 
template<typename ForwardIt >
void msg (const std::string &message, ForwardIt begin, ForwardIt end, Level log_lvl, int precision=3)
 

Static Public Member Functions

static std::string scientific (double val)
 Converts double to a string in scientific notation. More...
 

Public Attributes

Level max_trace_level = None
 
Level max_warn_level = None
 highest level of trace message that can be logged More...
 
bool data_dump = false
 highest level of warning/error that can be logged More...
 

Member Enumeration Documentation

◆ Level

Different levels of logging.

{Trace, Debug, Info} are hierarchical {Warn, Error} are hierarchical Fatal is always on DataDump is optional

Enumerator
None 
Trace 
Debug 
Info 
Warn 
Error 
Fatal 

Member Function Documentation

◆ msg() [1/2]

template<typename ForwardIt >
void molpro::linalg::itsolv::Logger::msg ( const std::string &  message,
ForwardIt  begin,
ForwardIt  end,
Level  log_lvl,
int  precision = 3 
)
inline

◆ msg() [2/2]

void molpro::linalg::itsolv::Logger::msg ( const std::string &  message,
Level  log_lvl 
)

◆ scientific()

std::string molpro::linalg::itsolv::Logger::scientific ( double  val)
static

Converts double to a string in scientific notation.

Member Data Documentation

◆ data_dump

bool molpro::linalg::itsolv::Logger::data_dump = false

highest level of warning/error that can be logged

◆ max_trace_level

Level molpro::linalg::itsolv::Logger::max_trace_level = None

◆ max_warn_level

Level molpro::linalg::itsolv::Logger::max_warn_level = None

highest level of trace message that can be logged