Added proper logging capabilities
This commit is contained in:
12
LXC/LXC.cpp
12
LXC/LXC.cpp
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user