mirror of
https://github.com/PashaBibko/LX.git
synced 2026-04-04 01:49:05 +00:00
Improved logger whilst debugger is active
This commit is contained in:
@@ -43,6 +43,10 @@ namespace LX
|
|||||||
|
|
||||||
// Else prints out the args as provided //
|
// Else prints out the args as provided //
|
||||||
else { (*s_LogFile << ... << args); }
|
else { (*s_LogFile << ... << args); }
|
||||||
|
|
||||||
|
// Flushes the log (only if debugger is attached) //
|
||||||
|
// Only flushes then as that is when the log is monitered during the process //
|
||||||
|
if (IsDebuggerPresent()) { s_LogFile->flush(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variadic template to allow an undefined ammount of arguments //
|
// Variadic template to allow an undefined ammount of arguments //
|
||||||
@@ -59,6 +63,10 @@ namespace LX
|
|||||||
*s_LogFile << '\n' << BREAK << '\n';
|
*s_LogFile << '\n' << BREAK << '\n';
|
||||||
(*s_LogFile << ... << args);
|
(*s_LogFile << ... << args);
|
||||||
*s_LogFile << '\n' << BREAK << '\n';
|
*s_LogFile << '\n' << BREAK << '\n';
|
||||||
|
|
||||||
|
// Flushes the log (only if debugger is attached) //
|
||||||
|
// Only flushes then as that is when the log is monitered during the process //
|
||||||
|
if (IsDebuggerPresent()) { s_LogFile->flush(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initalises the log //
|
// Initalises the log //
|
||||||
|
|||||||
@@ -245,11 +245,14 @@ namespace LX
|
|||||||
|
|
||||||
Log::out("\n"); // Puts a space to clean up the log
|
Log::out("\n"); // Puts a space to clean up the log
|
||||||
|
|
||||||
for (auto& token : tokens)
|
for (int i = 0; i < tokens.size(); i++)
|
||||||
{
|
{
|
||||||
|
Token& token = tokens[i];
|
||||||
|
|
||||||
Log::out<Log::Priority::HIGH>
|
Log::out<Log::Priority::HIGH>
|
||||||
(
|
(
|
||||||
std::left,
|
std::left,
|
||||||
|
"T-Index: ", std::setw(5), i,
|
||||||
" { Line: ", std::setw(3), token.line,
|
" { Line: ", std::setw(3), token.line,
|
||||||
", Index: ", std::setw(3), token.index,
|
", Index: ", std::setw(3), token.index,
|
||||||
", Length: ", std::setw(2), token.length, " } ",
|
", Length: ", std::setw(2), token.length, " } ",
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
func main()
|
func main()
|
||||||
{
|
{
|
||||||
int a
|
int a = 65465
|
||||||
a = 65465
|
|
||||||
|
|
||||||
int b
|
int b = 6
|
||||||
b = 6
|
|
||||||
|
|
||||||
return a + b
|
return a + b
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user