Fixed previous commit

This commit is contained in:
Pasha Bibko
2025-05-06 17:43:26 +01:00
parent f3a559490c
commit 0c34e7174e
3 changed files with 13 additions and 20 deletions

View File

@@ -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;
};
}

View File

@@ -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();
}
}