KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > trace > TraceTemplate


1 /*====================================================================
2
3 ObjectWeb Util Launcher Package.
4 Copyright (C) 2004 INRIA & USTL - LIFL - GOAL
5 Contact: architecture@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Romain Rouvoy.
23 Contributor(s): .
24
25 --------------------------------------------------------------------
26 $Id: TraceTemplate.java,v 1.2 2004/02/27 19:07:21 rouvoy Exp $
27 ====================================================================*/

28
29 package org.objectweb.util.trace;
30
31
32 import org.objectweb.util.monolog.api.BasicLevel;
33 import org.objectweb.util.monolog.api.Logger;
34
35
36 /**
37  * Specialization of the Monolog trace mechanism into a TraceSystem
38  * for dealing with trace in the scope of the Launcher.<BR>
39  * <p>
40  * The TraceTemplate class provides implementation of the trace
41  * interface based on Monolog implementation.
42  * </p>
43  *
44  * @author <a HREF="mailto:Romain.Rouvoy@lifl.fr">Romain Rouvoy</a>
45  * @version 0.1
46  */

47 public class TraceTemplate
48   implements Trace
49 {
50     /** underlying Monolog logger reference*/
51     protected Logger logger = null;
52     
53     /**
54      * Default Construtor.
55      *
56      * @param log Monolog logger to use.
57      */

58     public TraceTemplate(Logger log) {
59         setLogger(log);
60     }
61
62     /**
63      * @return Returns the logger.
64      */

65     public Logger getLogger() {
66         return logger;
67     }
68
69     /**
70      * @param logger The logger to set.
71      */

72     public void setLogger(Logger logger) {
73         this.logger = logger;
74     }
75
76     /**
77      * Displays a debug message.
78      *
79      * @param msg debugging message to print.
80      */

81     public void debug(String JavaDoc msg) {
82         getLogger().log(BasicLevel.DEBUG, msg);
83     }
84
85     /**
86      * Displays a debug message.
87      *
88      * @param msg information message to print.
89      */

90     public void info(String JavaDoc msg) {
91         getLogger().log(BasicLevel.INFO, msg);
92     }
93
94     /**
95      * Displays a debug message.
96      *
97      * @param msg warning message to print.
98      */

99     public void warn(String JavaDoc msg) {
100         getLogger().log(BasicLevel.WARN, msg);
101     }
102
103     /**
104      * Displays a debug message.
105      *
106      * @param msg error message to print.
107      */

108     public void error(String JavaDoc msg) {
109         getLogger().log(BasicLevel.ERROR, msg);
110     }
111
112     /**
113      * Displays a debug message.
114      *
115      * @param msg fatal message to print.
116      */

117     public void fatal(String JavaDoc msg) {
118         getLogger().log(BasicLevel.FATAL, msg);
119     }
120 }
121
Popular Tags