2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
9
* http://www.apache.org/licenses/LICENSE-2.0
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
18
package org.apache.ivy.util;
20
import java.util.ArrayList;
21
import java.util.List;
24
* An abstract base class to ease {@link MessageLogger} implementation.
26
public abstract class AbstractMessageLogger implements MessageLogger {
27
private List problems = new ArrayList();
29
private List warns = new ArrayList();
31
private List errors = new ArrayList();
33
private boolean showProgress = true;
36
* @see org.apache.ivy.util.MessageLogger#debug(java.lang.String)
38
public void debug(String msg) {
39
log(msg, Message.MSG_DEBUG);
43
* @see org.apache.ivy.util.MessageLogger#verbose(java.lang.String)
45
public void verbose(String msg) {
46
log(msg, Message.MSG_VERBOSE);
50
* @see org.apache.ivy.util.MessageLogger#deprecated(java.lang.String)
52
public void deprecated(String msg) {
53
log("DEPRECATED: " + msg, Message.MSG_WARN);
58
* @see org.apache.ivy.util.MessageLogger#info(java.lang.String)
60
public void info(String msg) {
61
log(msg, Message.MSG_INFO);
65
* @see org.apache.ivy.util.MessageLogger#info(java.lang.String)
67
public void rawinfo(String msg) {
68
rawlog(msg, Message.MSG_INFO);
72
* @see org.apache.ivy.util.MessageLogger#warn(java.lang.String)
74
public void warn(String msg) {
75
log("WARN: " + msg, Message.MSG_VERBOSE);
76
problems.add("WARN: " + msg);
81
* @see org.apache.ivy.util.MessageLogger#error(java.lang.String)
83
public void error(String msg) {
84
// log in verbose mode because message is appended as a problem, and will be
85
// logged at the end at error level
86
log("ERROR: " + msg, Message.MSG_VERBOSE);
87
problems.add("\tERROR: " + msg);
92
* @see org.apache.ivy.util.MessageLogger#getProblems()
94
public List getProblems() {
99
* @see org.apache.ivy.util.MessageLogger#sumupProblems()
101
public void sumupProblems() {
102
MessageLoggerHelper.sumupProblems(this);
106
public void clearProblems() {
112
public List getErrors() {
116
public List getWarns() {
121
* @see org.apache.ivy.util.MessageLogger#progress()
123
public void progress() {
131
* @see org.apache.ivy.util.MessageLogger#endProgress()
133
public void endProgress() {
138
* @see org.apache.ivy.util.MessageLogger#endProgress(java.lang.String)
140
public void endProgress(String msg) {
148
* @see org.apache.ivy.util.MessageLogger#isShowProgress()
150
public boolean isShowProgress() {
155
* @see org.apache.ivy.util.MessageLogger#setShowProgress(boolean)
157
public void setShowProgress(boolean progress) {
158
showProgress = progress;
162
* Indicates a progression for a long running task
164
protected abstract void doProgress();
166
* Indicates the end of a long running task
167
* @param msg the message associated with long running task end.
169
protected abstract void doEndProgress(String msg);