001 package com.agilejava.blammo;
002
003 /*
004 * Copyright (C) 2006, Wilfred Springer
005 *
006 * This library is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 2.1 of the License, or (at your option) any later version.
010 *
011 * This library is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public
017 * License along with this library; if not, write to the Free Software
018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
019 */
020
021 /**
022 * The interface to be implemented by all logging toolkit adapters. (Think of it
023 * as a rudimentary interface similar to Commons Logging, without the
024 * bootstrapping mechanism.)
025 *
026 * @author Wilfred Springer
027 */
028 public interface LoggingKitAdapter {
029
030 /**
031 * The INFO log level.
032 */
033 final String LEVEL_INFO = "info";
034
035 /**
036 * The DEBUG log level.
037 */
038 final String LEVEL_DEBUG = "debug";
039
040 /**
041 * The ERROR log level.
042 */
043 final String LEVEL_ERROR = "error";
044
045 /**
046 * The WARN log level.
047 */
048 final String LEVEL_WARN = "warn";
049
050 /**
051 * Logs a message, passing in the log level and the message.
052 *
053 * @param level
054 * The log level. (Either {@link #LEVEL_DEBUG},
055 * {@link #LEVEL_ERROR}, {@link #LEVEL_INFO} or
056 * {@link #LEVEL_WARN}).
057 * @param producer
058 * The {@link MessageProducer} producing the message.
059 */
060 void log(String level, MessageProducer producer);
061
062 /**
063 * Logs the message, passing in the log level, the message and the
064 * <code>Throwable</code>.
065 *
066 * @param level
067 * The log level. (Either {@link #LEVEL_DEBUG},
068 * {@link #LEVEL_ERROR}, {@link #LEVEL_INFO} or
069 * {@link #LEVEL_WARN}).
070 * @param message
071 * The {@link MessageProducer} producing the message.
072 * @param throwable
073 * The associated exception.
074 */
075 void log(String level, MessageProducer producer, Throwable throwable);
076
077 }