01: package org.apache.velocity.runtime.log;
02:
03: /*
04: * Licensed to the Apache Software Foundation (ASF) under one
05: * or more contributor license agreements. See the NOTICE file
06: * distributed with this work for additional information
07: * regarding copyright ownership. The ASF licenses this file
08: * to you under the Apache License, Version 2.0 (the
09: * "License"); you may not use this file except in compliance
10: * with the License. You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing,
15: * software distributed under the License is distributed on an
16: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17: * KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations
19: * under the License.
20: */
21:
22: import org.apache.velocity.runtime.RuntimeServices;
23:
24: /**
25: * Base interface that logging systems need to implement. This
26: * is the blessed descendant of the old LogSystem interface.
27: *
28: * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a>
29: * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
30: * @author <a href="mailto:nbubna@apache.org">Nathan Bubna</a>
31: * @version $Id: LogChute.java 494611 2007-01-09 21:57:20Z henning $
32: */
33: public interface LogChute {
34: /** Prefix string for trace messages. */
35: String TRACE_PREFIX = " [trace] ";
36:
37: /** Prefix string for debug messages. */
38: String DEBUG_PREFIX = " [debug] ";
39:
40: /** Prefix string for info messages. */
41: String INFO_PREFIX = " [info] ";
42:
43: /** Prefix string for warn messages. */
44: String WARN_PREFIX = " [warn] ";
45:
46: /** Prefix string for error messages. */
47: String ERROR_PREFIX = " [error] ";
48:
49: /** ID for trace messages. */
50: int TRACE_ID = -1;
51:
52: /** ID for debug messages. */
53: int DEBUG_ID = 0;
54:
55: /** ID for info messages. */
56: int INFO_ID = 1;
57:
58: /** ID for warning messages. */
59: int WARN_ID = 2;
60:
61: /** ID for error messages. */
62: int ERROR_ID = 3;
63:
64: /**
65: * Initializes this LogChute.
66: * @param rs
67: * @throws Exception
68: */
69: void init(RuntimeServices rs) throws Exception;
70:
71: /**
72: * Send a log message from Velocity.
73: * @param level
74: * @param message
75: */
76: void log(int level, String message);
77:
78: /**
79: * Send a log message from Velocity along with an exception or error
80: * @param level
81: * @param message
82: * @param t
83: */
84: void log(int level, String message, Throwable t);
85:
86: /**
87: * Tell whether or not a log level is enabled.
88: * @param level
89: * @return True if a level is enabled.
90: */
91: boolean isLevelEnabled(int level);
92:
93: }
|