1 /* 2 * Modification History 3 * 4 * 2002-February-25 Jason Rohrer 5 * Created. 6 * 7 * 2002-March-29 Jason Rohrer 8 * Added Fortify inclusion. 9 */ 10 11 #include "minorGems/common.h" 12 13 14 15 #ifndef LOG_INCLUDED 16 #define LOG_INCLUDED 17 18 19 20 #ifdef FORTIFY 21 #include "minorGems/util/development/fortify/fortify.h" 22 #endif 23 24 25 26 /** 27 * An interface for a class that can perform logging functions. 28 * 29 * @author Jason Rohrer 30 */ 31 class Log { 32 33 34 35 public: 36 37 // These levels were copied from the JLog framework 38 // by Todd Lauinger 39 40 static const int DEACTIVATE_LEVEL; 41 42 static const int CRITICAL_ERROR_LEVEL; 43 44 static const int ERROR_LEVEL; 45 46 static const int WARNING_LEVEL; 47 48 static const int INFO_LEVEL; 49 50 static const int DETAIL_LEVEL; 51 52 static const int TRACE_LEVEL; 53 54 55 56 // provided so that virtual deletes work properly 57 virtual ~Log(); 58 59 60 61 /** 62 * Sets the logging level of the current log. 63 * 64 * Messages with levels above the current level will not be logged. 65 * 66 * @param inLevel one of the defined logging levels. 67 */ 68 virtual void setLoggingLevel( int inLevel ) = 0; 69 70 71 72 /** 73 * Gets the logging level of the current log. 74 * 75 * Messages with levels above the current level will not be logged. 76 * 77 * @return one of the defined logging levels. 78 */ 79 virtual int getLoggingLevel() = 0; 80 81 82 83 /** 84 * Logs a string in this log under the default logger name. 85 * 86 * @param inString the string to log as a \0-terminated string. 87 * Must be destroyed by caller. 88 * @param inLevel the level to log inString at. 89 */ 90 virtual void logString( char *inString, int inLevel ) = 0; 91 92 93 94 /** 95 * Logs a string in this log, specifying a logger name. 96 * 97 * @param inLoggerName the name of the logger 98 * as a \0-terminated string. 99 * Must be destroyed by caller. 100 * @param inString the string to log as a \0-terminated string. 101 * Must be destroyed by caller. 102 * @param inLevel the level to log inString at. 103 */ 104 virtual void logString( char *inLoggerName, char *inString, 105 int inLevel ) = 0; 106 107 108 109 }; 110 111 112 113 #endif 114