Source code: com/lutris/logging/LogChannel.java
1 /*
2 * Enhydra Java Application Server Project
3 *
4 * The contents of this file are subject to the Enhydra Public License
5 * Version 1.1 (the "License"); you may not use this file except in
6 * compliance with the License. You may obtain a copy of the License on
7 * the Enhydra web site ( http://www.enhydra.org/ ).
8 *
9 * Software distributed under the License is distributed on an "AS IS"
10 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11 * the License for the specific terms governing rights and limitations
12 * under the License.
13 *
14 * The Initial Developer of the Enhydra Application Server is Lutris
15 * Technologies, Inc. The Enhydra Application Server and portions created
16 * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17 * All Rights Reserved.
18 *
19 * Contributor(s):
20 *
21 * $Id: LogChannel.java,v 1.11.8.1 2000/10/19 17:58:53 jasona Exp $
22 */
23
24 package com.lutris.logging;
25
26 /**
27 * Interface of a channel associated with a logging facility. All messages
28 * for the facility are written using a channel.
29 *
30 * @author Mark Diekhans
31 * @see com.lutris.logging.Logger
32 * @see com.lutris.logging.LogWriter
33 */
34 public interface LogChannel {
35 /**
36 * Determine if logging is enabled for the specified level. This
37 * is useful to prevent a series of unnecessary logging calls,
38 * as often encountered with debug logging, or a call where generating
39 * the message is expensive.
40 *
41 * @param level Numeric level that is to be checked.
42 * @return <CODE>true</CODE> if enabled, <CODE>false</CODE> if not
43 * enabled.
44 */
45 boolean isEnabled(int level);
46
47 /**
48 * Determine if logging is enabled for the specified level. This
49 * is useful to prevent a series of unnecessary logging calls,
50 * as often encountered with debug logging, or a call where generating
51 * the message is expensive.
52 *
53 * @param level Symbolic level that is to be checked.
54 * @return <CODE>true</CODE> if enabled, <CODE>false</CODE> if not
55 * enabled.
56 */
57 boolean isEnabled(String level);
58
59 /**
60 * Convert a symbolic level to an integer identifier.
61 *
62 * @param level Symbolic level to convert
63 * @return The numeric level identifier
64 */
65 int getLevel(String level);
66
67 /**
68 * Create a LogWrite associated with a particular level. This
69 * is often an easier object to use than a LogChannel if limited
70 * levels are needed.
71 *
72 * @param level Symbolic level that is to be checked.
73 * @return A log writer object.
74 */
75 LogWriter getLogWriter(String level);
76
77 /**
78 * Create a LogWrite associated with a particular level. This
79 * is often an easier object to use than a LogChannel if limited
80 * levels are needed.
81 *
82 * @param level Numeric level that is to be checked.
83 * @return A log writer object.
84 */
85 LogWriter getLogWriter(int level);
86
87 /**
88 * Write a string to the log file.
89 *
90 * @param level Numeric level the message is associated with.
91 * @param msg The message to log.
92 */
93 void write(int level, String msg);
94
95 /**
96 * Write a string to the log file.
97 *
98 * @param level Symbolic level the message is associated with.
99 * @param msg The message to log.
100 */
101 void write(String level, String msg);
102
103 /**
104 * Write a string and exception to the log file.
105 *
106 * @param level Numeric level the message is associated with.
107 * @param msg The message to log.
108 * @param throwable Exception or error to log.
109 */
110 void write(int level, String msg, Throwable throwable);
111
112
113 /**
114 * Write a string and exception to the log file.
115 *
116 * @param level Symbolic level the message is associated with.
117 * @param msg The message to log.
118 * @param throwable Exception or error to log.
119 */
120 void write(String level, String msg, Throwable throwable);
121 }