public static void main(String[] args) { AbstractLogger chainLogger = getLoggerChain(); chainLogger.logMessage(AbstractLogger.DEBUG, "The system is set up."); chainLogger.logMessage(AbstractLogger.ERROR, "The coffee ran out"); chainLogger.logMessage(AbstractLogger.INFO, "Karate of Geri is my Geri."); chainLogger.logMessage(AbstractLogger.DEBUG, "System shut down."); }
private static AbstractLogger getLoggerChain() { AbstractLogger errorLogger = new ErrorLogger(AbstractLogger.ERROR); AbstractLogger consoleLogger = new ConsoleLogger(AbstractLogger.INFO); AbstractLogger debugLogger = new FileLogger(AbstractLogger.DEBUG); errorLogger.setNextLogger(debugLogger); debugLogger.setNextLogger(consoleLogger); return errorLogger; }
/** * The text uses MessageFormat and will insert the following metrics: * * <p>Total Available GPU Memory: {0} * * <p>Current Available GPU Memory: {1} * * <p>Vendor name: {2} * * @param text The text to show in the logging message. */ @Override public void setText(final String text) { super.setText(text); }