Add fatal errors.
Errors are fatal if the program has to stop immediately.
This commit is contained in:
parent
1fee4f5afd
commit
4c1bae86ba
|
@ -63,6 +63,7 @@ void init()
|
||||||
keywords::format =
|
keywords::format =
|
||||||
"%LineID% [%TimeStamp%] "
|
"%LineID% [%TimeStamp%] "
|
||||||
"[%ThreadID%]: [%Severity%] %Message%");
|
"[%ThreadID%]: [%Severity%] %Message%");
|
||||||
|
|
||||||
boost::log::add_console_log(std::cerr,
|
boost::log::add_console_log(std::cerr,
|
||||||
keywords::format = translate("WARNING").str()
|
keywords::format = translate("WARNING").str()
|
||||||
+ ": %Message%")
|
+ ": %Message%")
|
||||||
|
@ -71,6 +72,11 @@ void init()
|
||||||
keywords::format = translate("ERROR").str()
|
keywords::format = translate("ERROR").str()
|
||||||
+ ": %Message%")
|
+ ": %Message%")
|
||||||
->set_filter(boost::log::trivial::severity == sev::error);
|
->set_filter(boost::log::trivial::severity == sev::error);
|
||||||
|
boost::log::add_console_log(std::cerr,
|
||||||
|
keywords::format = translate("FATAL ERROR")
|
||||||
|
.str()
|
||||||
|
+ ": %Message%")
|
||||||
|
->set_filter(boost::log::trivial::severity == sev::fatal);
|
||||||
|
|
||||||
boost::log::add_common_attributes();
|
boost::log::add_common_attributes();
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
catch (std::exception &e)
|
catch (std::exception &e)
|
||||||
{ // Exceptions we can't recover from or ones we don't know.
|
{ // Exceptions we can't recover from or ones we don't know.
|
||||||
LOG(lg, log::sev::error)
|
LOG(lg, log::sev::fatal)
|
||||||
<< e.what() << translate(" (while parsing options)");
|
<< e.what() << translate(" (while parsing options)");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user