galdar496 / QiGameEngine

Realtime Game Engine designed with C++ and OpenGL.
http://qiengine.blogspot.com/
1 stars 0 forks source link

Change the logging system to write to an html file #21

Closed galdar496 closed 9 years ago

galdar496 commented 9 years ago

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:

<br><font color=\"#FF0000\"><b>My text</b></font><br>

would generate a bolded, red string saying "My text". Colors are as follows:

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>

and end with something like this:

<font color=\"#000000\"><br><br>LOG END<br></font></body></html>
galdar496 commented 9 years ago

Fixed with 29ab60e0be3fa44d0990b7a677c0003d547c7bcb