Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages | Examples

ArLog.h

00001 /*
00002 MobileRobots Advanced Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004, 2005 ActivMedia Robotics LLC
00004 Copyright (C) 2006, 2007 MobileRobots Inc.
00005 
00006      This program is free software; you can redistribute it and/or modify
00007      it under the terms of the GNU General Public License as published by
00008      the Free Software Foundation; either version 2 of the License, or
00009      (at your option) any later version.
00010 
00011      This program is distributed in the hope that it will be useful,
00012      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014      GNU General Public License for more details.
00015 
00016      You should have received a copy of the GNU General Public License
00017      along with this program; if not, write to the Free Software
00018      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 If you wish to redistribute ARIA under different terms, contact 
00021 MobileRobots for information about a commercial version of ARIA at 
00022 robots@mobilerobots.com or 
00023 MobileRobots Inc, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481
00024 */
00025 
00026 #ifndef ARLOG_H
00027 #define ARLOG_H
00028 
00029 #ifndef WIN32
00030 #include <stdio.h>
00031 #endif
00032 #include <string>
00033 #include "ariaTypedefs.h"
00034 #include "ArMutex.h"
00035 #include "ArFunctor.h"
00036 
00037 class ArConfig;
00038 
00040 
00047 class ArLog
00048 {
00049 public:
00050 
00051   typedef enum {
00052     StdOut, 
00053     StdErr, 
00054     File, 
00055     Colbert, 
00056     None 
00057   } LogType;
00058   typedef enum {
00059     Terse, 
00060     Normal, 
00061     Verbose 
00062   } LogLevel;
00063 
00064 #ifndef SWIG
00065 
00071   AREXPORT static void log(LogLevel level, const char *str, ...);
00072 #endif
00073 
00074   AREXPORT static void logPlain(LogLevel level, const char *str);
00076   AREXPORT static bool init(LogType type, LogLevel level,
00077                 const char *fileName="",
00078                 bool logTime = false, bool alsoPrint = false, 
00079                 bool printThisCall = true);
00081   AREXPORT static void close();
00082 
00083 #ifndef SWIG // this is internal we don't need to wrap it
00084   // Do not use this unless you know what you are doing...
00087   AREXPORT static void logNoLock(LogLevel level, const char *str, ...);
00088 #endif 
00089   // We use this to print to a Colbert stream, if available
00090   AREXPORT static void (* colbertPrint)(int i, const char *str);
00091 
00093   AREXPORT static void addToConfig(ArConfig *config);
00094 protected:
00095   AREXPORT static bool processFile(void);
00096 
00097   static ArLog *ourLog;
00098   static ArMutex ourMutex;
00099   static LogType ourType;
00100   static LogLevel ourLevel;
00101   static bool ourLoggingTime;
00102   static FILE *ourFP;
00103   static int ourColbertStream;
00104   static std::string ourFileName;
00105   static bool ourAlsoPrint;
00106   
00107   static LogType ourConfigLogType;
00108   static LogLevel ourConfigLogLevel;
00109   static char ourConfigFileName[1024];
00110   static bool ourConfigLogTime;
00111   static bool ourConfigAlsoPrint;
00112   static ArGlobalRetFunctor<bool> ourConfigProcessFileCB;
00113 };
00114 
00115 
00116 #endif

Generated on Tue Feb 20 10:51:40 2007 for Aria by  doxygen 1.4.0