001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: */
018: package org.apache.ivy.util;
019:
020: import java.util.List;
021:
022: /**
023: * A MessageLogger is used to log messages.
024: * <p>
025: * Where the messages are logged is depending on the implementation.
026: * </p>
027: * <p>
028: * This interface provides both level specific methods ({@link #info(String)},
029: * {@link #warn(String)}, ...) and generic methods ({@link #log(String, int)},
030: * {@link #rawlog(String, int)}). Note that calling level specific methods is usually not
031: * equivalent to calling the generic method with the corresponding level. Indeed, for warn and error
032: * level, the implementation will actually log the message at a lower level (usually
033: * {@link Message#MSG_VERBOSE}) and log the message at the actual level only when
034: * {@link #sumupProblems()} is called.
035: * </p>
036: *
037: * @see Message
038: */
039: public interface MessageLogger {
040: /**
041: * Logs a message at the given level.
042: * <p>
043: * <code>level</code> constants are defined in the {@link Message} class.
044: * </p>
045: *
046: * @param msg
047: * the message to log
048: * @param level
049: * the level at which the message should be logged.
050: * @see Message#MSG_DEBUG
051: * @see Message#MSG_VERBOSE
052: * @see Message#MSG_INFO
053: * @see Message#MSG_WARN
054: * @see Message#MSG_ERROR
055: */
056: public abstract void log(String msg, int level);
057:
058: /**
059: * Same as {@link #log(String, int)}, but without adding any contextual information to the
060: * message.
061: *
062: * @param msg
063: * the message to log
064: * @param level
065: * the level at which the message should be logged.
066: */
067: public abstract void rawlog(String msg, int level);
068:
069: public abstract void debug(String msg);
070:
071: public abstract void verbose(String msg);
072:
073: public abstract void deprecated(String msg);
074:
075: public abstract void info(String msg);
076:
077: public abstract void rawinfo(String msg);
078:
079: public abstract void warn(String msg);
080:
081: public abstract void error(String msg);
082:
083: public abstract List/*<String>*/getProblems();
084:
085: public abstract List/*<String>*/getWarns();
086:
087: public abstract List/*<String>*/getErrors();
088:
089: /**
090: * Clears the list of problems, warns and errors.
091: */
092: public abstract void clearProblems();
093:
094: /**
095: * Sumup all problems encountered so far, and clear them.
096: */
097: public abstract void sumupProblems();
098:
099: public abstract void progress();
100:
101: public abstract void endProgress();
102:
103: public abstract void endProgress(String msg);
104:
105: public abstract boolean isShowProgress();
106:
107: public abstract void setShowProgress(boolean progress);
108:
109: }
|