Lowered default message logging priority to info.
This commit is contained in:
parent
39c0e27cb2
commit
002f875c53
@ -31,7 +31,7 @@ int main(int argc, char **argv)
|
||||
("parsing-mode", po::value<std::string>()->default_value("strict"), "Parsing mode (strict, compatibility)")
|
||||
("language,l", po::value<std::string>()->default_value("auto"), "Input language (pddl, sas, auto)")
|
||||
("color", po::value<std::string>()->default_value("auto"), "Colorize output (always, never, auto)")
|
||||
("log-priority,p", po::value<std::string>()->default_value("warning"), "Log messages starting from this priority (debug, info, warning, error)")
|
||||
("log-priority,p", po::value<std::string>()->default_value("info"), "Log messages starting from this priority (debug, info, warning, error)")
|
||||
("warnings-as-errors", po::bool_switch(&warningsAsErrors), "Treat warnings as errors");
|
||||
|
||||
po::positional_options_description positionalOptionsDescription;
|
||||
|
@ -57,7 +57,7 @@ Logger::Logger(ColorStream &&outputStream)
|
||||
Logger::Logger(ColorStream &&outputStream, ColorStream &&errorStream)
|
||||
: m_outputStream{outputStream},
|
||||
m_errorStream{errorStream},
|
||||
m_logPriority{Priority::Warning},
|
||||
m_logPriority{Priority::Info},
|
||||
m_abortPriority{Priority::Error}
|
||||
{
|
||||
}
|
||||
@ -104,14 +104,20 @@ void Logger::log(Priority priority, const char *message)
|
||||
{
|
||||
const auto priorityID = static_cast<int>(priority);
|
||||
|
||||
if (priorityID < static_cast<int>(m_logPriority))
|
||||
if (priorityID < static_cast<int>(m_logPriority) &&
|
||||
priorityID < static_cast<int>(m_abortPriority))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_errorStream
|
||||
<< priorityFormat(priority) << priorityName(priority) << ":"
|
||||
<< ResetFormat() << " "
|
||||
<< MessageBodyFormat << message
|
||||
<< ResetFormat() << std::endl;
|
||||
|
||||
if (priority != Priority::Error && priorityID >= static_cast<int>(m_abortPriority))
|
||||
throw std::runtime_error("received warning (treated as error by configuration)");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -144,7 +150,8 @@ void Logger::log(Priority priority, const tokenize::Location &location, const ch
|
||||
<< ResetFormat() << std::endl;
|
||||
|
||||
// TODO: print original warning message
|
||||
if (priorityID >= static_cast<int>(m_abortPriority))
|
||||
// TODO: refactor
|
||||
if (priority != Priority::Error && priorityID >= static_cast<int>(m_abortPriority))
|
||||
throw std::runtime_error("received warning (treated as error by configuration)");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user