Clover Coverage Report
Coverage timestamp: Sa Aug 2 2008 13:56:27 CEST
../../../../../img/srcFileCovDistChart5.png 74% of files have more coverage
33   157   25   3
14   91   0,76   11
11     2,27  
1    
 
  QedeqLog       Line # 33 33 25 43,1% 0.43103448
 
  (37)
 
1    /* $Id: QedeqLog.java,v 1.1 2008/07/26 07:58:29 m31 Exp $
2    *
3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
4    *
5    * Copyright 2000-2008, Michael Meyling <mime@qedeq.org>.
6    *
7    * "Hilbert II" is free software; you can redistribute
8    * it and/or modify it under the terms of the GNU General Public
9    * License as published by the Free Software Foundation; either
10    * version 2 of the License, or (at your option) any later version.
11    *
12    * This program 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
15    * GNU General Public License for more details.
16    */
17   
18    package org.qedeq.kernel.bo.log;
19   
20    import java.net.URL;
21    import java.util.ArrayList;
22    import java.util.List;
23   
24    import org.qedeq.base.trace.Trace;
25   
26   
27    /**
28    * This class organizes the logging.
29    *
30    * @version $Revision: 1.1 $
31    * @author Michael Meyling
32    */
 
33    public final class QedeqLog implements LogListener {
34   
35    /** This class. */
36    private static final Class CLASS = QedeqLog.class;
37   
38    /** The one and only instance. */
39    private static QedeqLog instance = new QedeqLog();
40   
41    /** The loggers. */
42    private List loggers = new ArrayList();
43   
44   
45    /**
46    * Get instance of Logger.
47    *
48    * @return singleton
49    */
 
50  1474 toggle public static final QedeqLog getInstance() {
51  1474 return instance;
52    }
53   
54   
55    /**
56    * Don't use me outside of this class.
57    */
 
58  7 toggle private QedeqLog() {
59    }
60   
61    /**
62    * Add listener.
63    *
64    * @param log Add this listener.
65    */
 
66  0 toggle public final void addLog(final LogListener log) {
67  0 loggers.add(log);
68  0 Trace.paramInfo(CLASS, this, "addLog(LogListener)", "log", log.getClass());
69    }
70   
71    /**
72    * Remove listener.
73    *
74    * @param log Remove this listener.
75    */
 
76  39 toggle public final void removeLog(final LogListener log) {
77  39 loggers.remove(log);
78  39 Trace.paramInfo(CLASS, this, "removeLog(LogListener)", "log", log.getClass());
79    }
80   
 
81  0 toggle public void logMessageState(final String text, final URL url) {
82  0 for (int i = 0; i < loggers.size(); i++) {
83  0 try { // we don't know if the LogListener is free of programming errors...
84  0 ((LogListener) loggers.get(i)).logMessageState(text, url);
85    } catch (RuntimeException e) {
86  0 Trace.fatal(CLASS, this, "logMessageState", "LogListener throwed RuntimeException",
87    e);
88    }
89    }
90    }
91   
 
92  96 toggle public void logFailureState(final String text, final URL url, final String description) {
93  96 for (int i = 0; i < loggers.size(); i++) {
94  0 try { // we don't know if the LogListener is free of programming errors...
95  0 ((LogListener) loggers.get(i)).logFailureState(text, url, description);
96    } catch (RuntimeException e) {
97  0 Trace.fatal(CLASS, this, "logFailureState", "LogListener throwed RuntimeException",
98    e);
99    }
100    }
101    }
102   
 
103  867 toggle public void logSuccessfulState(final String text, final URL url) {
104  867 for (int i = 0; i < loggers.size(); i++) {
105  0 try { // we don't know if the LogListener is free of programming errors...
106  0 ((LogListener) loggers.get(i)).logSuccessfulState(text, url);
107    } catch (RuntimeException e) {
108  0 Trace.fatal(CLASS, this, "logSuccessfulState",
109    "LogListener throwed RuntimeException", e);
110    }
111    }
112    }
113   
 
114  122 toggle public void logRequest(final String text) {
115  122 for (int i = 0; i < loggers.size(); i++) {
116  0 try { // we don't know if the LogListener is free of programming errors...
117  0 ((LogListener) loggers.get(i)).logRequest(text);
118    } catch (RuntimeException e) {
119  0 Trace.fatal(CLASS, this, "logRequest", "LogListener throwed RuntimeException", e);
120    }
121    }
122    }
123   
 
124  108 toggle public void logSuccessfulReply(final String text) {
125  108 try { // we don't know if the LogListener is free of programming errors...
126  108 for (int i = 0; i < loggers.size(); i++) {
127  0 ((LogListener) loggers.get(i)).logSuccessfulReply(text);
128    }
129    } catch (RuntimeException e) {
130  0 Trace.fatal(CLASS, this, "logSuccessfulReply", "LogListener throwed RuntimeException",
131    e);
132    }
133    }
134   
 
135  8 toggle public void logFailureReply(final String text, final String description) {
136  8 for (int i = 0; i < loggers.size(); i++) {
137  0 try { // we don't know if the LogListener is free of programming errors...
138  0 ((LogListener) loggers.get(i)).logFailureReply(text, description);
139    } catch (RuntimeException e) {
140  0 Trace.fatal(CLASS, this, "logFailureReply", "LogListener throwed RuntimeException",
141    e);
142    }
143    }
144    }
145   
 
146  234 toggle public void logMessage(final String text) {
147  234 for (int i = 0; i < loggers.size(); i++) {
148  0 try { // we don't know if the LogListener is free of programming errors...
149  0 ((LogListener) loggers.get(i)).logMessage(text);
150    } catch (RuntimeException e) {
151  0 Trace.fatal(CLASS, this, "logMessage", "LogListener throwed RuntimeException", e);
152    }
153    }
154    }
155   
156   
157    }