8 std::vector<std::string> Logger::level_to_string;
9 std::map<std::string, LogLevel> Logger::string_to_level;
11 bool Logger::no_agent =
false;
12 bool Logger::no_mem =
false;
14 int Logger::spc_per_lev_ = 2;
15 int Logger::field_width_ = 6;
25 prefix = prefix.substr(0, prefix_len);
26 if (prefix.length() < prefix_len) {
27 prefix = prefix +
std::string(prefix_len - prefix.length(),
' ');
29 os <<
ToString(level) <<
"(" << prefix <<
"):";
38 fprintf(stdout,
"%s",
os.str().c_str());
43 void Logger::Initialize() {
45 Logger::AddLevel(
LEV_WARN,
"LEV_WARN");
60 if (string_to_level.count(text) > 0) {
61 return string_to_level[text];
71 text = level_to_string.at((
int)level);
81 Logger::string_to_level[text] = level;
82 text = text.substr(4);
83 text =
std::string(field_width_ - text.size(),
' ') + text;
84 Logger::level_to_string.push_back(text);
Information helpful for simulation users and developers alike.
static std::string ToString(LogLevel level)
Converts a LogLevel enum value into a corrsponding string.
static LogLevel ToLogLevel(std::string text)
Converts a string into a corresponding LogLevel value.
debugging information - most verbose
Information helpful for simulation users and developers alike - least verbose.
Use to report questionable simulation state (use extremely sparingly)
Code providing rudimentary logging capability for the Cyclus core.
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
debugging information - least verbose
Information helpful for simulation users and developers alike.
std::ostringstream & Get(LogLevel level, std::string prefix)
Returns a string stream by reference that is flushed to stdout by the Logger class destructor...
Information helpful for simulation users and developers alike.
Information helpful for simulation users and developers alike - most verbose.
Use for errors that require agent code or input file modification (use extremely sparingly) ...
LogLevel
categorical (verbosity) levels for log statements.