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.tools.ant.util;
19:
20: import org.apache.tools.ant.Project;
21: import org.apache.tools.ant.Task;
22:
23: /**
24: * A facade that makes logging nicer to use.
25: */
26: public final class TaskLogger {
27: /**
28: * Task to use to do logging.
29: */
30: private Task task;
31:
32: /**
33: * Constructor for the TaskLogger
34: * @param task the task
35: */
36: public TaskLogger(final Task task) {
37: this .task = task;
38: }
39:
40: /**
41: * Log a message with <code>MSG_INFO</code> priority
42: * @param message the message to log
43: */
44: public void info(final String message) {
45: task.log(message, Project.MSG_INFO);
46: }
47:
48: /**
49: * Log a message with <code>MSG_ERR</code> priority
50: * @param message the message to log
51: */
52: public void error(final String message) {
53: task.log(message, Project.MSG_ERR);
54: }
55:
56: /**
57: * Log a message with <code>MSG_WARN</code> priority
58: * @param message the message to log
59: */
60: public void warning(final String message) {
61: task.log(message, Project.MSG_WARN);
62: }
63:
64: /**
65: * Log a message with <code>MSG_VERBOSE</code> priority
66: * @param message the message to log
67: */
68: public void verbose(final String message) {
69: task.log(message, Project.MSG_VERBOSE);
70: }
71:
72: /**
73: * Log a message with <code>MSG_DEBUG</code> priority
74: * @param message the message to log
75: */
76: public void debug(final String message) {
77: task.log(message, Project.MSG_DEBUG);
78: }
79: }
|