HelloAurora/Tests/Common/console.hpp

54 lines
1.2 KiB
C++
Raw Normal View History

2022-02-19 22:25:03 +00:00
/***
Copyright (c) 2020 Reece Wilson (a/k/a "Reece"). All rights reserved.
File: console.hpp
Date: 2020-6-9
Originator: Reece
Purpose:
***/
#pragma once
#include <string>
#include <fmt/format.h>
namespace Aurora::UnitTesting::Console
{
enum class AnsiColor
{
kRed,
kBoldRed,
kGreen,
kBoldGreen,
kYellow,
kBoldYellow,
kBlue,
kBoldBlue,
kMagenta,
kBoldMagenta,
kCyan,
kBoldCyan,
kReset,
kCount
};
void Init();
void WriteLine(const std::string &prefix, AnsiColor color, const std::string &msg);
template<typename... Args>
static void Log(const std::string &fmt, Args... args)
{
WriteLine("Log", AnsiColor::kGreen, fmt::format(fmt, args...));
}
template<typename... Args>
static void Warn(const std::string &fmt, Args... args)
{
WriteLine("Warn", AnsiColor::kRed, fmt::format(fmt, args...));
}
template<typename... Args>
static void Debug(const std::string &fmt, Args... args)
{
WriteLine("Debug", AnsiColor::kYellow, fmt::format(fmt, args...));
}
}