• Advertisement
Sign in to follow this  
  • entries
    61
  • comments
    131
  • views
    32140

My Logger system!

Sign in to follow this  

104 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]
Sign in to follow this  


2 Comments


Recommended Comments

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.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement