Tag Archives: log

Small Log System

Here is a small piece of code that can be useful if you need to quickly generate traces (or log) in your apps:

class cLog
{
public:
  cLog(char *logfile){};
  static void trace(const char *s)
  { if(s) log <<  s << std::endl; };
  static std::ofstream log;
};
std::ofstream cLog::log("c:\\app_log.txt");

Just use it as follows:

cLog::trace("this is a log");
cLog::trace("this is a second trace");