JeGX HackLAB


Archive for the ‘log’ tag

[English]Small Log System[/English][French]Petit Système de Log[/French]

with one comment

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

[French]
Voilà un petit bout de code qui peut être utile si vous avez besoin de générer rapidement des traces (ou log) dans vos applications:
[/French]

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");

[English]
Just use it as follows:
[/English]

[French]
Il suffit de l’utiliser de la manière suivante:
[/French]

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

Written by JeGX

May 27th, 2008 at 4:08 pm

Posted in Programming

Tagged with , , ,