mirror of
https://github.com/PashaBibko/LX.git
synced 2026-04-03 17:39:02 +00:00
- Moved some classes from Lexer.h to seperate (non-Global files) - Deleted dllmain as it wasn't used for the most part
49 lines
904 B
C++
49 lines
904 B
C++
namespace LX
|
|
{
|
|
class COMMON_API Log
|
|
{
|
|
public:
|
|
// This class should never be constructed //
|
|
Log() = delete;
|
|
|
|
enum class Format
|
|
{
|
|
AUTO,
|
|
NONE
|
|
};
|
|
|
|
template<Format format = Format::AUTO, typename... Args>
|
|
static void out(Args... args)
|
|
{
|
|
if constexpr (format == Format::AUTO)
|
|
{
|
|
((*s_LogFile << ... << args) << "\n");
|
|
}
|
|
|
|
else
|
|
{
|
|
(*s_LogFile << ... << args);
|
|
}
|
|
}
|
|
|
|
template<typename... Args>
|
|
static void LogNewSection(Args... args)
|
|
{
|
|
static const char* BREAK = "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";
|
|
|
|
*s_LogFile << '\n' << BREAK << '\n';
|
|
(*s_LogFile << ... << args);
|
|
*s_LogFile << '\n' << BREAK << '\n';
|
|
}
|
|
|
|
private:
|
|
// Initalises the log (Called by DllMain) //
|
|
static void Init();
|
|
|
|
// Closes the log (Called by DllMain) //
|
|
static void Close();
|
|
|
|
static std::ofstream* s_LogFile;
|
|
};
|
|
}
|