Removed error message prefixes.

This commit is contained in:
Patrick Lühne 2016-06-14 15:06:43 +02:00
parent a6c9434590
commit 777c9839a1
3 changed files with 10 additions and 10 deletions

View File

@ -101,7 +101,7 @@ int main(int argc, char **argv)
if (language == plasp::Language::Type::Unknown) if (language == plasp::Language::Type::Unknown)
{ {
plasp::utils::Logger logger; plasp::utils::Logger logger;
logger.exception("error", "unknown input language"); logger.logError("unknown input language");
std::cout << std::endl; std::cout << std::endl;
printHelp(); printHelp();
return EXIT_FAILURE; return EXIT_FAILURE;
@ -132,25 +132,25 @@ int main(int argc, char **argv)
catch (const plasp::utils::ParserException &e) catch (const plasp::utils::ParserException &e)
{ {
plasp::utils::Logger logger; plasp::utils::Logger logger;
logger.parserException(e.coordinate(), e.message()); logger.logError(e.coordinate(), e.message());
return EXIT_FAILURE; return EXIT_FAILURE;
} }
catch (const plasp::utils::ParserWarning &e) catch (const plasp::utils::ParserWarning &e)
{ {
plasp::utils::Logger logger; plasp::utils::Logger logger;
logger.parserException(e.coordinate(), e.message()); logger.logError(e.coordinate(), e.message());
return EXIT_FAILURE; return EXIT_FAILURE;
} }
catch (const plasp::utils::TranslatorException &e) catch (const plasp::utils::TranslatorException &e)
{ {
plasp::utils::Logger logger; plasp::utils::Logger logger;
logger.exception("translation error", e.what()); logger.logError(e.what());
return EXIT_FAILURE; return EXIT_FAILURE;
} }
catch (const std::exception &e) catch (const std::exception &e)
{ {
plasp::utils::Logger logger; plasp::utils::Logger logger;
logger.exception("unexpected error", e.what()); logger.logError(e.what());
return EXIT_FAILURE; return EXIT_FAILURE;
} }

View File

@ -38,8 +38,8 @@ class Logger
void setWarningLevel(WarningLevel warningLevel); void setWarningLevel(WarningLevel warningLevel);
void exception(const std::string &errorType, const std::string &message); void logError(const std::string &message);
void parserException(const Parser::Coordinate &coordinate, const std::string &message); void logError(const Parser::Coordinate &coordinate, const std::string &message);
void parserWarning(const Parser &parser, const std::string &message); void parserWarning(const Parser &parser, const std::string &message);
private: private:

View File

@ -62,12 +62,12 @@ void Logger::setWarningLevel(WarningLevel warningLevel)
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
void Logger::exception(const std::string &errorType, const std::string &message) void Logger::logError(const std::string &message)
{ {
if (isatty(STDERR_FILENO)) if (isatty(STDERR_FILENO))
{ {
std::cerr std::cerr
<< Format(Color::Red, FontWeight::Bold) << errorType << ":" << Format(Color::Red, FontWeight::Bold) << "error:"
<< ResetFormat() << " " << ResetFormat() << " "
<< Format(Color::White, FontWeight::Bold) << message << Format(Color::White, FontWeight::Bold) << message
<< ResetFormat() << std::endl; << ResetFormat() << std::endl;
@ -84,7 +84,7 @@ void Logger::exception(const std::string &errorType, const std::string &message)
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
void Logger::parserException(const Parser::Coordinate &coordinate, const std::string &message) void Logger::logError(const Parser::Coordinate &coordinate, const std::string &message)
{ {
if (isatty(STDERR_FILENO)) if (isatty(STDERR_FILENO))
{ {