src/include/common/base/Log.h

00001 /*
00002  * Copyright (C) 2003-2007 Funambol, Inc
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 version 2 as
00006  * published by the Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY, TITLE, NONINFRINGEMENT or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00016  * 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 
00072         size_t getLogSize();
00073 
00074         // FIXME!
00075         //void printMessageW(const char* level, const WCHAR* msg, va_list argList);
00076 
00077     };
00078 
00079     extern Log LOG;
00081 #endif

Generated on Fri Nov 9 12:21:24 2007 for Funambol Outlook Plug-in Library by  doxygen 1.5.2