KickJava   Java API By Example, From Geeks To Geeks.

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


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: EnhydraXMLCLogger.java,v 1.2 2005/03/24 10:51:20 slobodan Exp $
22  */

23
24 package com.lutris.logging;
25
26
27 import org.enhydra.xml.xmlc.XMLCLogger;
28
29 /**
30  * XMLC logger interface to PrintWriter streams.
31  */

32 public class EnhydraXMLCLogger implements XMLCLogger {
33
34   //underlying implementation
35
private final com.lutris.logging.LogChannel m_logChannel;
36
37     /**
38      * Constructor specifing a single stream to be used for both info
39      * and error logging.
40      */

41     public EnhydraXMLCLogger(LogChannel logChannel) {
42         
43         m_logChannel = logChannel;
44     }
45
46     /**
47      * Determine if info logging is enabled.
48      */

49     public boolean infoEnabled() {
50         return m_logChannel.isEnabled(Logger.INFO);
51     }
52
53     /**
54      * Login an info message.
55      */

56     public void logInfo(String JavaDoc msg) {
57       m_logChannel.write( Logger.INFO, msg );
58     }
59
60     /**
61      * Login an info message with exception.
62      */

63     public void logInfo(String JavaDoc msg,
64                         Throwable JavaDoc except) {
65       m_logChannel.write( Logger.INFO, msg, except );
66     }
67
68     /**
69      * Determine if error logging is enabled.
70      */

71     public boolean errorEnabled() {
72         return m_logChannel.isEnabled(Logger.ERROR);
73     }
74
75     /**
76      * Login an error message.
77      */

78     public void logError(String JavaDoc msg) {
79       m_logChannel.write( Logger.ERROR, msg );
80     }
81
82     /**
83      * Login an error message with exception.
84      */

85     public void logError(String JavaDoc msg,
86                          Throwable JavaDoc except) {
87       m_logChannel.write( Logger.ERROR, msg, except );
88     }
89
90     /**
91      * Determine if debug logging is enabled.
92      */

93     public boolean debugEnabled() {
94         return m_logChannel.isEnabled(Logger.DEBUG);
95     }
96
97     /**
98      * Login an debug message.
99      */

100     public void logDebug(String JavaDoc msg) {
101       m_logChannel.write( Logger.DEBUG, msg );
102     }
103
104     /**
105      * Login an debug message with exception.
106      */

107     public void logDebug(String JavaDoc msg,
108                          Throwable JavaDoc except) {
109       m_logChannel.write( Logger.DEBUG, msg, except );
110     }
111
112 }
113
Popular Tags