1 package gov.nist.core; 2 3 import java.util.Properties; 4 5 6 /** 7 * interface that loggers should implement so that the stack can log to various 8 * loggers impl such as log4j, commons logging, sl4j, ... 9 * @author jean.deruelle (at) gmail.com 10 * 11 */ 12 public interface StackLogger extends LogLevels { 13 14 /** 15 * log a stack trace. This helps to look at the stack frame. 16 */ 17 public void logStackTrace(); 18 19 /** 20 * Log a stack trace if the current logging level exceeds 21 * given trace level. 22 * @param traceLevel 23 */ 24 public void logStackTrace(int traceLevel); 25 26 /** 27 * Get the line count in the log stream. 28 * 29 * @return 30 */ 31 public int getLineCount(); 32 33 /** 34 * Log an exception. 35 * 36 * @param ex 37 */ 38 public void logException(Throwable ex); 39 /** 40 * Log a message into the log file. 41 * 42 * @param message 43 * message to log into the log file. 44 */ 45 public void logDebug(String message); 46 /** 47 * Log a message into the log file. 48 * 49 * @param message 50 * message to log into the log file. 51 */ 52 public void logTrace(String message); 53 /** 54 * Log an error message. 55 * 56 * @param message -- 57 * error message to log. 58 */ 59 public void logFatalError(String message); 60 /** 61 * Log an error message. 62 * 63 * @param message -- 64 * error message to log. 65 * 66 */ 67 public void logError(String message); 68 /** 69 * @return flag to indicate if logging is enabled. 70 */ 71 public boolean isLoggingEnabled(); 72 /** 73 * Return true/false if loging is enabled at a given level. 74 * 75 * @param logLevel 76 */ 77 public boolean isLoggingEnabled(int logLevel); 78 /** 79 * Log an error message. 80 * 81 * @param message 82 * @param ex 83 */ 84 public void logError(String message, Exception ex); 85 /** 86 * Log a warning mesasge. 87 * 88 * @param string 89 */ 90 public void logWarning(String string); 91 /** 92 * Log an info message. 93 * 94 * @param string 95 */ 96 public void logInfo(String string); 97 98 99 /** 100 * Disable logging altogether. 101 * 102 */ 103 public void disableLogging(); 104 105 /** 106 * Enable logging (globally). 107 */ 108 public void enableLogging(); 109 110 /** 111 * Set the build time stamp. This is logged into the logging stream. 112 */ 113 public void setBuildTimeStamp(String buildTimeStamp); 114 115 /** 116 * Stack creation properties. 117 * @param stackProperties 118 */ 119 120 public void setStackProperties(Properties stackProperties); 121 122 /** 123 * The category for the logger. 124 * @return 125 */ 126 public String getLoggerName(); 127 128 129 130 } 131