• entries
61
131
• views
32282

# My Logger system!

127 views

Yay! My first completed project with some weight in it!

I present to you my very own logging system!
I'm honored if anyone can just test it out and give me some feedback as to what to do with it next. [smile] Currently only supports text files. Oh, and it's C++!

Thanks!

EDIT: version 0.6 is up [smile]

It looked really nice and compact, but I had a couple suggestions. First being the addition of variable arguments in your WriteToFile() function or a WriteToFileEx() or something (I use variable arguments a lot for debugging.) Another is a timestamp, which is fairly easy to via _strtime():
char szTime[9];
_strtime(szTime);

file<<"["<<szTime<<"]: "<<text<<"\n";


Timestamps aren't very important, I just find them helpful sometimes (telling how long some things take, when certain errors occur, etc.)

The most important thing though is that you're not flushing your log, which in a bug situation might cause your information to not be written. My advise would be to replace:
file<<text<<"\n";

//with
file<<text<<std::endl; // std::endl adds a newline and flushes the log, so you wouldn't need '\n'.


And, I always have to suggest an HTML log. They can be very helpful in most situations (red text sticks out A LOT.) They can also just be time-saving. For example, when I log that a screenshot was taken, I add a link and since my log automatically opens after the app has finished I just click the link to get my screenshot instead of searching for the folder and then looking through it for my screenshot.

All in all it was very well written and nicely done.

Oh, thank you soo much for testing it out! [smile]

## Create an account

Register a new account