Add fatal errors.

Errors are fatal if the program has to stop immediately.
This commit is contained in:
tastytea 2021-05-31 22:29:35 +02:00
parent 1fee4f5afd
commit 4c1bae86ba
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 7 additions and 1 deletions

View File

@ -63,6 +63,7 @@ void init()
keywords::format =
"%LineID% [%TimeStamp%] "
"[%ThreadID%]: [%Severity%] %Message%");
boost::log::add_console_log(std::cerr,
keywords::format = translate("WARNING").str()
+ ": %Message%")
@ -71,6 +72,11 @@ void init()
keywords::format = translate("ERROR").str()
+ ": %Message%")
->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();
}

View File

@ -76,7 +76,7 @@ int main(int argc, char *argv[])
}
catch (std::exception &e)
{ // 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)");
return EXIT_FAILURE;
}