mirror of
https://github.com/PashaBibko/LX.git
synced 2026-04-03 17:39:02 +00:00
Fixed previous commit
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
namespace LX
|
||||
{
|
||||
// Static class used for logging information //
|
||||
class COMMON_API Log
|
||||
{
|
||||
public:
|
||||
// This class should never be constructed //
|
||||
// It acts like a fancy namespace //
|
||||
Log() = delete;
|
||||
|
||||
enum class Format
|
||||
@@ -15,15 +17,11 @@ namespace LX
|
||||
template<Format format = Format::AUTO, typename... Args>
|
||||
static void out(Args... args)
|
||||
{
|
||||
if constexpr (format == Format::AUTO)
|
||||
{
|
||||
((*s_LogFile << ... << args) << "\n");
|
||||
}
|
||||
// Prints out the args ending with a new line unless specified //
|
||||
if constexpr (format == Format::AUTO) { ((*s_LogFile << ... << args) << "\n"); }
|
||||
|
||||
else
|
||||
{
|
||||
(*s_LogFile << ... << args);
|
||||
}
|
||||
// Else prints out the args as provided //
|
||||
else { (*s_LogFile << ... << args); }
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
@@ -36,13 +34,11 @@ namespace LX
|
||||
*s_LogFile << '\n' << BREAK << '\n';
|
||||
}
|
||||
|
||||
private:
|
||||
// Initalises the log (Called by DllMain) //
|
||||
static void Init();
|
||||
|
||||
// Closes the log (Called by DllMain) //
|
||||
static void Close();
|
||||
|
||||
private:
|
||||
// Keeps the pointer hidden to stop accidental changes //
|
||||
static std::ofstream* s_LogFile;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,12 +15,4 @@ namespace LX
|
||||
actualLog.open("log");
|
||||
s_LogFile = &actualLog;
|
||||
}
|
||||
|
||||
void Log::Close()
|
||||
{
|
||||
// Flushes and closes the log //
|
||||
// Yes I know closing automatically flushes but this function looked empty //
|
||||
s_LogFile->flush();
|
||||
s_LogFile->close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include <Parser.h>
|
||||
#include <Lexer.h>
|
||||
|
||||
#include <../Lexer/inc/LexerErrors.h> // <- TEMP (I hope)
|
||||
|
||||
namespace LX
|
||||
{
|
||||
// Different errors thrown by main //
|
||||
@@ -35,6 +37,9 @@ namespace LX
|
||||
|
||||
extern "C" int __declspec(dllexport) GenIR(const char* a_inpPath, const char* a_outPath)
|
||||
{
|
||||
// Initalises the log //
|
||||
LX::Log::Init();
|
||||
|
||||
// Creates the file paths outside of the try-catch so they can be used in errors //
|
||||
std::filesystem::path inpPath;
|
||||
std::filesystem::path outPath;
|
||||
|
||||
Reference in New Issue
Block a user