src/include/common/base/Log.h

00001 /*
00002  * Copyright (C) 2003-2007 Funambol
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  */
00018 
00019 #ifndef INCL_LOG
00020     #define INCL_LOG
00021 
00023     #include "fscapi.h"
00024 
00025     #define LOG_ERROR "ERROR"
00026     #define LOG_INFO  "INFO"
00027     #define LOG_DEBUG "DEBUG"
00028 
00029     #define LOG_NAME "synclog.txt"
00030 
00031     typedef enum {
00032         LOG_LEVEL_NONE  = 0,
00033         LOG_LEVEL_INFO  = 1,
00034         LOG_LEVEL_DEBUG = 2
00035     } LogLevel;
00036 
00037     extern char logmsg[];
00038 
00039     class Log {
00040 
00041     private:
00042 
00043         void printMessage(const char*  level, const char*  msg, va_list argList);
00044 
00045         /*
00046          * Which log level is set?
00047          */
00048         LogLevel logLevel;
00049 
00050     public:
00051     
00052         Log(BOOL reset = FALSE, const char*  path = NULL, const char*  name = NULL);
00053         ~Log();
00054         
00055         void setLogPath(const char*  configLogPath);
00056         void setLogName(const char*  configLogName);
00057         
00058         void error(const char*  msg, ...);
00059         void info(const char*  msg, ...);
00060         void debug(const char*  msg, ...);
00061         void trace(const char*  msg);
00062 
00063         void reset(const char*  title = NULL);
00064 
00065         void setLevel(LogLevel level);
00066 
00067         LogLevel getLevel();
00068 
00069         BOOL isLoggable(LogLevel level);
00070 
00071         // FIXME!
00072         //void printMessageW(const char* level, const WCHAR* msg, va_list argList);
00073 
00074     };
00075 
00076     extern Log LOG;
00078 #endif

Generated on Fri Apr 27 12:29:18 2007 for Funambol C++ Client Library by  doxygen 1.5.2