KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lutris > logging > LogChannel


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.1 2005/07/13 11:09:06 slobodan Exp $
22  */

23 package com.lutris.logging;
24
25 /**
26  * Interface of a channel associated with a logging facility. All messages
27  * for the facility are written using a channel.
28  *
29  * @author Mark Diekhans
30  * @see com.lutris.logging.Logger
31  * @see com.lutris.logging.LogWriter
32  */

33 public interface LogChannel {
34
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 JavaDoc 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 JavaDoc 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 JavaDoc 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 JavaDoc 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 JavaDoc level, String JavaDoc 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 JavaDoc msg, Throwable JavaDoc throwable);
111     
112     /**
113      * Write a string and exception to the log file.
114      *
115      * @param level Symbolic level the message is associated with.
116      * @param msg The message to log.
117      * @param throwable Exception or error to log.
118      */

119     void write(String JavaDoc level, String JavaDoc msg, Throwable JavaDoc throwable);
120 }
121
Popular Tags