1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
//
// C++ Implementation: filelog
//
// Description:
//
//
// Author: Arsenij Vodjanov <arsenij@gmail.com>, (C) 2005
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "filelog.h"
#define FLOG_ENABLE
// This should be retrieved from gui settings
#define FLOG_FILE_NAME "/tmp/backend.log"
using namespace std;
FileLog::FileLog() : fos(FLOG_FILE_NAME) {
fos << "--- Starting Log ----" << endl;
}
void FileLog::info(const boost::format& fmt)
{
#ifdef FLOG_ENABLE
fos << fmt << endl;
#endif
}
void FileLog::error(const boost::format& fmt)
{
#ifdef FLOG_ENABLE
fos << fmt << endl;
#endif
}
void FileLog::warn(const boost::format& fmt)
{
#ifdef FLOG_ENABLE
fos << fmt << endl;
#endif
}
void FileLog::debug(const boost::format& fmt,int level)
{
#ifdef FLOG_ENABLE
if(level <= debugLevel )
fos << fmt << endl;
#endif
}
FileLog::~FileLog()
{
#ifdef FLOG_ENABLE
fos << "--- Ending Log ----" << endl;
fos.flush();
fos.close();
#endif
}
|