mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 00:37:15 +01:00
Respect logging time-stamp config.
This commit is contained in:
parent
70a5eaa5d1
commit
c8e5012642
@ -167,7 +167,7 @@ static inline void OutputConsoleMessage(const Logger::MsgPtr & msg)
|
||||
CONSOLE_SCREEN_BUFFER_INFO csb_state;
|
||||
GetConsoleScreenBufferInfo(hstdout, &csb_state);
|
||||
SetConsoleTextAttribute(hstdout, GetLevelColor(msg->mLvl));
|
||||
if (msg->mTms)
|
||||
if (Logger::Get().ConsoleHasTime())
|
||||
{
|
||||
std::printf("%s %s ", GetLevelTag(msg->mLvl), msg->mBuf);
|
||||
}
|
||||
@ -179,7 +179,7 @@ static inline void OutputConsoleMessage(const Logger::MsgPtr & msg)
|
||||
std::printf("%s\n", msg->mStr.c_str());
|
||||
SetConsoleTextAttribute(hstdout, csb_state.wAttributes);
|
||||
#else
|
||||
if (msg->mTms)
|
||||
if (Logger::Get().ConsoleHasTime())
|
||||
{
|
||||
std::printf("%s %s %s\033[0m\n",
|
||||
msg->mSub ? GetColoredLevelTagDim(msg->mLvl) : GetColoredLevelTag(msg->mLvl), msg->mBuf, msg->mStr.c_str());
|
||||
@ -532,8 +532,6 @@ void Logger::ProcessMessage()
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Override time-stamp requirements
|
||||
m_Message->mTms = (m_ConsoleTime || m_LogFileTime);
|
||||
// Are we allowed to send this message level to console?
|
||||
if (m_ConsoleLevels & m_Message->mLvl)
|
||||
{
|
||||
@ -546,7 +544,7 @@ void Logger::ProcessMessage()
|
||||
std::fputs(GetLevelTag(m_Message->mLvl), m_File);
|
||||
std::fputc(' ', m_File);
|
||||
// Should we include the time-stamp?
|
||||
if (m_Message->mTms)
|
||||
if (m_LogFileTime)
|
||||
{
|
||||
std::fputs(m_Message->mBuf, m_File);
|
||||
std::fputc(' ', m_File);
|
||||
|
@ -52,7 +52,7 @@ protected:
|
||||
uint8_t mLvl; // Message level.
|
||||
uint8_t mInc; // Message increments.
|
||||
bool mSub; // Message hierarchy.
|
||||
bool mTms; // Message hierarchy.
|
||||
bool mTms; // Message time-stamp.
|
||||
char mBuf[TMS_LEN]; // Message time-stamp.
|
||||
/* ----------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
@ -155,8 +155,8 @@ private:
|
||||
MsgQueue m_Queue; // Queue of messages outside of main thread.
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
uint8_t m_ConsoleLevels; // The levels allowed to be outputted to console.
|
||||
uint8_t m_LogFileLevels; // The levels allowed to be outputted to log file.
|
||||
uint8_t m_ConsoleLevels; // The levels allowed to be outputted to console.
|
||||
uint8_t m_LogFileLevels; // The levels allowed to be outputted to log file.
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
bool m_ConsoleTime; // Whether console messages should be timestamped.
|
||||
@ -164,7 +164,7 @@ private:
|
||||
bool m_CyclicLock; // Prevent the script callback from entering a loop.
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
uint32_t m_StringTruncate; // The length at which to truncate strings in debug.
|
||||
uint32_t m_StringTruncate; // The length at which to truncate strings in debug.
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
std::FILE* m_File; // Handle to the file where the logs should be saved.
|
||||
|
Loading…
Reference in New Issue
Block a user