I just implemented something like this you can create a generic write function and then #include it in the files you want it used. I have no idea if this is a great idea but it works.
Code:
#include "logger.h"
#ifdef DEBUG
std::ofstream out;
void Logger(const char *write, bool error)
{
if(error)
{
out.open("Error.txt",std::ios::app);
}
else
{
out.open("Log.txt",std::ios::app);
}
out<<write<<std::endl<<std::endl;
out.close();
}
#endif//DEBUG
#ifndef DEBUG
void Logger(const char *write, bool error)
{
}
#endif//DEBUG
So on a non debug build the code basically does nothing.