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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user