Added proper logging capabilities

This commit is contained in:
Pasha Bibko
2025-07-20 18:09:29 +01:00
parent 903b4da7df
commit 9dedcf30b1
6 changed files with 115 additions and 8 deletions

View File

@@ -6,6 +6,9 @@ int main(int argc, char** argv)
{
using namespace LXC;
// Creates the debug log //
Util::CreateLog("LXC.log");
// Reads the given file to a string //
Util::ReturnVal fileContents = Util::ReadFile("example/example.lx");
if (fileContents.Failed()) _UNLIKELY
@@ -18,9 +21,12 @@ int main(int argc, char** argv)
Util::PrintAs<Util::LIGHT_RED>(" Error: ");
Util::PrintLn(Util::FileReadError::ReasonStr(err.reason), " [", std::filesystem::absolute(err.path), ']');
Util::Log("Opening source file failed. Stopping program.");
Util::Stop();
}
Util::Log("Succesfully opened source file.");
// Turns the file contents into a vector of tokens //
Util::ReturnVal tokens = Lexer::TokenizeFile(fileContents);
if (tokens.Failed()) _UNLIKELY
@@ -31,5 +37,11 @@ int main(int argc, char** argv)
Util::Stop();
}
// Prints all of the tokens to the log //
for (const auto& token : tokens.Result())
{
Util::Log(token);
}
return 0;
}