2021-01-25 00:24:31 +01:00
|
|
|
#ifndef LIBREPOMGR_LOGGING_H
|
|
|
|
#define LIBREPOMGR_LOGGING_H
|
|
|
|
|
2021-02-25 16:59:36 +01:00
|
|
|
#include "./logcontext.h"
|
|
|
|
|
2021-01-25 00:24:31 +01:00
|
|
|
#include "./buildactions/buildaction.h"
|
|
|
|
|
|
|
|
namespace LibRepoMgr {
|
|
|
|
|
|
|
|
inline auto ps(CppUtilities::EscapeCodes::Phrases phrase)
|
|
|
|
{
|
|
|
|
return CppUtilities::EscapeCodes::formattedPhraseString(phrase);
|
|
|
|
}
|
|
|
|
|
2021-02-25 16:59:36 +01:00
|
|
|
template <typename... Args> LIBREPOMGR_EXPORT LogContext &LogContext::operator()(std::string &&msg)
|
2021-01-25 00:24:31 +01:00
|
|
|
{
|
|
|
|
std::cerr << msg;
|
|
|
|
if (m_buildAction) {
|
|
|
|
m_buildAction->appendOutput(std::move(msg));
|
|
|
|
}
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2021-02-25 16:59:36 +01:00
|
|
|
template <typename... Args> inline LogContext &LogContext::operator()(CppUtilities::EscapeCodes::Phrases phrase, Args &&...args)
|
2021-01-25 00:24:31 +01:00
|
|
|
{
|
|
|
|
return (*this)(CppUtilities::argsToString(CppUtilities::EscapeCodes::formattedPhraseString(phrase), std::forward<Args>(args)...));
|
|
|
|
}
|
|
|
|
|
2021-02-25 16:59:36 +01:00
|
|
|
template <typename... Args> inline LogContext &LogContext::operator()(Args &&...args)
|
2021-01-25 00:24:31 +01:00
|
|
|
{
|
|
|
|
return (*this)(CppUtilities::argsToString(
|
|
|
|
CppUtilities::EscapeCodes::formattedPhraseString(CppUtilities::EscapeCodes::Phrases::InfoMessage), std::forward<Args>(args)...));
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace LibRepoMgr
|
|
|
|
|
|
|
|
#endif // LIBREPOMGR_LOGGING_H
|