arch-repo-manager/librepomgr/logcontext.h

35 lines
1.0 KiB
C
Raw Normal View History

2021-02-25 16:59:36 +01:00
#ifndef LIBREPOMGR_LOGCONTEXT_H
#define LIBREPOMGR_LOGCONTEXT_H
// Do NOT include this header directly, include "loggin.h" instead. This header only exists to resolve the
// cyclic dependency between LogContext and BuildAction but lacks definitions of operator().
#include "./global.h"
#include <c++utilities/io/ansiescapecodes.h>
namespace LibRepoMgr {
struct BuildAction;
struct LIBREPOMGR_EXPORT LogContext {
explicit LogContext(BuildAction *buildAction = nullptr);
LogContext &operator=(const LogContext &) = delete;
2022-02-05 22:09:52 +01:00
LogContext &operator=(LogContext &&) = default;
2021-02-25 16:59:36 +01:00
template <typename... Args> LogContext &operator()(CppUtilities::EscapeCodes::Phrases phrase, Args &&...args);
template <typename... Args> LogContext &operator()(Args &&...args);
template <typename... Args> LogContext &operator()(std::string &&msg);
private:
2022-02-05 22:09:52 +01:00
BuildAction *m_buildAction;
2021-02-25 16:59:36 +01:00
};
inline LogContext::LogContext(BuildAction *buildAction)
: m_buildAction(buildAction)
{
}
} // namespace LibRepoMgr
#endif // LIBREPOMGR_LOGCONTEXT_H