001 package toolbus.logging;
002
003 public interface ILogger{
004 public final static String LOGSTR = "LOG";
005 public final static String FATALSTR = "FATAL";
006 public final static String ERRORSTR = "ERROR";
007 public final static String WARNINGSTR = "WARNING";
008 public final static String INFOSTR = "INFO";
009 public final static String DEBUGSTR = "DEBUG";
010 public final static String UNKNOWNSTR = "UNKNOWN";
011
012 public final static int OFF = 0x00000000;
013
014 public final static int LOG = 0x00000003;
015 public final static int FATAL = 0x00000007;
016 public final static int ERROR = 0x0000000f;
017 public final static int WARNING = 0x0000001f;
018 public final static int INFO = 0x0000003f;
019 public final static int DEBUG = 0x0000007f;
020
021 public final static int ALL = 0x000000ff;
022
023 /**
024 * Toggle timestamp printing in messages
025 *
026 * @param on
027 * Sets timestamp on or off.
028 */
029 void setTimestamp(boolean on);
030
031 /**
032 * Logs the given message (but only if the message is 'important' enough).
033 *
034 * @param message
035 * The message that needs to be logged.
036 * @param loglevel
037 * The log level of the message.
038 */
039 void log(String message, int loglevel);
040
041 /**
042 * Logs the given message, including the given stacktrace (but only if the message is
043 * 'important' enough).
044 *
045 * @param message
046 * The message that needs to be logged.
047 * @param throwable
048 * The stacktrace associated with the message.
049 * @param loglevel
050 * The log level of the message.
051 */
052 void log(String message, Throwable throwable, int loglevel);
053 }