Heya lads!
Am starting a new project and trying to be really organized. So, before jumping in with all the fun stuff, I am writing is piece by piece, module by module, starting with a simple logging system to keep track of what's going on!
However, I am having trouble with outputting the file. I can get the textfile open and whatnot and even enter an error with a timestamp, but it only holds a single log entry. I was hoping to have a compiled entry, like adding a new line for every entry. Here is the basic code right now;
// Open Class: Logger
class Logger
{
public:
bool addEntry( char* Entry )
{
ofstream log;
log.open( LOGPATH );
if( log.is_open( ) )
{
log << Entry << "n";
log.close( );
}
else
{
cout << "Unable to open log file!" << endl;
exit(1);
}
return true;
}
}; // Close Class: Logger
I stripped out all the other stuff so you can see the barebone basics =D
Anyhow, if anyone knows how to just
add a line to the log, rather than replacing the entire text file, I would appreciate the help!
Thanks!
Bishop
Tux is my guildmaster.