Hi all,
I'm hoping to find some direction with a recent task I was assigned. I'm a fairly experienced AI programmer- but have very little experience creating log managers as this was someone else's job - until now. I am hoping that you can give me some guidance....
The data we would be collecting with the log manager is all game related, mostly AI related information. But really the data itself should be fairly transparent, as what I am after is something that can be used with ANY class in our system. I want to stay away from hooking it to a db (though the manager could certainly be modified for that later).
Based upon this, and the need to reuse the code as much as possible, I'm thinking of beginning with a singleton template...but am not sure if it will work.
Thoughts?
Thanks!
Our logger is a singleton with macros to do the logging. If you don't call the LOG_START macro then all the logging calls write to /dev/null.
If you call the start macro then we replace the mock logger with an appropriate one( file/web/etc)
Cheers
Chris
If you call the start macro then we replace the mock logger with an appropriate one( file/web/etc)
Cheers
Chris
CheersChris
There is a thread about loggers here that just started up recently to discuss what a logger should be...
You seem to need a "manager" type logger, kinda like the one in Doom3 maybe?
Something that keeps track of a lot more than just what is logged. Has a way to segregate the sources of the logged information into the distict places where it was logged from?
A simple logger is something that is easy to snap together using just global functions and #defines.
And a logger should probably be kept simple at the heart if you expect it to be robust enough to survive a program crash.
What features were you specifically looking for as far as logging capibility?
You seem to need a "manager" type logger, kinda like the one in Doom3 maybe?
Something that keeps track of a lot more than just what is logged. Has a way to segregate the sources of the logged information into the distict places where it was logged from?
A simple logger is something that is easy to snap together using just global functions and #defines.
And a logger should probably be kept simple at the heart if you expect it to be robust enough to survive a program crash.
What features were you specifically looking for as far as logging capibility?
I created a class Logging.h that I include anytime I want to log information.
There are several major functions.
EnableLogging sets a flag to true so everything can be logged to a file.
I also have multiple overloaded functions WriteToLog that I use to record information. Anytime something is working the way it suppose to all i have to do is this.
Logging log;
log.EnableLogging();
int a, b;
log.WriteToLog("==============");
log.WriteToLog(a);
log.WriteToLog(b);
log.WriteToLog("==============");
Is this basically what your looking for, because if it is I can post a copy of my Logging.h here so you can reference it. I used the classes fstream and iostream to do simple file output.
There are several major functions.
EnableLogging sets a flag to true so everything can be logged to a file.
I also have multiple overloaded functions WriteToLog that I use to record information. Anytime something is working the way it suppose to all i have to do is this.
Logging log;
log.EnableLogging();
int a, b;
log.WriteToLog("==============");
log.WriteToLog(a);
log.WriteToLog(b);
log.WriteToLog("==============");
Is this basically what your looking for, because if it is I can post a copy of my Logging.h here so you can reference it. I used the classes fstream and iostream to do simple file output.
Adamhttp://www.allgamedevelopment.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement