Using HTML, we'll get platform-agnostic log files that can be color coded and easily viewed regardless of the OS that generated them. Things to remember are:
& can't go directly into text, has to be replaced by &
< can't go directly into text, has to be replaced by <
> can't go directly into text, has to be replaced by >
\n can't go directly into text, has to be replaced by
would generate a bolded, red string saying "My text". Colors are as follows:
FF0000 - Red
FF8000 - Yellow
000000 - Black
I think the best approach may be to take the file writing out of the logger class and instead create an HTMLWriter class (or something like that) which takes an incoming message and writes the corresponding HTML for it. Then when the logger is initialized it can be passed an instance of a Writer class (or something like that, which would be the base class for HTMLWriter) which has an overriden function to write out the data. This way we could install future writers for other formats if we feel like it.
The file has to start with something like this:
<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"><title>Qi Game Engine Log</title></head></body>
Using HTML, we'll get platform-agnostic log files that can be color coded and easily viewed regardless of the OS that generated them. Things to remember are:
Coloring would be slightly different also:
would generate a bolded, red string saying "My text". Colors are as follows:
FF0000 - Red
FF8000 - Yellow
000000 - Black
I think the best approach may be to take the file writing out of the logger class and instead create an HTMLWriter class (or something like that) which takes an incoming message and writes the corresponding HTML for it. Then when the logger is initialized it can be passed an instance of a Writer class (or something like that, which would be the base class for HTMLWriter) which has an overriden function to write out the data. This way we could install future writers for other formats if we feel like it.
The file has to start with something like this:
and end with something like this: