01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
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.
16: *
17: */
18: package org.apache.ivy.util;
19:
20: import java.util.Iterator;
21: import java.util.List;
22:
23: public final class MessageLoggerHelper {
24: public static void sumupProblems(MessageLogger logger) {
25: List myProblems = logger.getProblems();
26: if (myProblems.size() > 0) {
27: List myWarns = logger.getWarns();
28: List myErrors = logger.getErrors();
29: logger.info(""); // new line on info to isolate error summary
30: if (!myErrors.isEmpty()) {
31: logger.log(":: problems summary ::", Message.MSG_ERR);
32: } else {
33: logger.log(":: problems summary ::", Message.MSG_WARN);
34: }
35: if (myWarns.size() > 0) {
36: logger.log(":::: WARNINGS", Message.MSG_WARN);
37: for (Iterator iter = myWarns.iterator(); iter.hasNext();) {
38: String msg = (String) iter.next();
39: logger.log("\t" + msg + "\n", Message.MSG_WARN);
40: }
41: }
42: if (myErrors.size() > 0) {
43: logger.log(":::: ERRORS", Message.MSG_ERR);
44: for (Iterator iter = myErrors.iterator(); iter
45: .hasNext();) {
46: String msg = (String) iter.next();
47: logger.log("\t" + msg + "\n", Message.MSG_ERR);
48: }
49: }
50: logger
51: .info("\n:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS");
52: }
53: }
54:
55: private MessageLoggerHelper() {
56: }
57: }
|