Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
../../../../../img/srcFileCovDistChart6.png 80% of files have more coverage
6   69   4   1.5
0   21   0.67   4
4     1  
1    
 
  ModuleLogListenerImpl       Line # 27 6 4 60% 0.6
 
  (3)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10    * This program is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13    * GNU General Public License for more details.
14    */
15   
16    package org.qedeq.kernel.bo.log;
17   
18    import java.io.PrintStream;
19   
20    import org.qedeq.base.utility.DateUtility;
21   
22    /**
23    * Listener that writes events to a stream.
24    *
25    * @author Michael Meyling
26    */
 
27    public final class ModuleLogListenerImpl implements ModuleLogListener {
28   
29    /** Stream for output. */
30    private PrintStream out = System.out;
31   
32    /** For this module we are logging. */
33    private final String moduleUrl;
34   
35    /**
36    * Constructor.
37    *
38    * @param moduleUrl We log for this module.
39    */
 
40  0 toggle public ModuleLogListenerImpl(final String moduleUrl) {
41  0 this(moduleUrl, System.out);
42    }
43   
44    /**
45    * Constructor.
46    *
47    * @param moduleUrl We log for this module.
48    * @param stream Print to this stream.
49    */
 
50  3 toggle public ModuleLogListenerImpl(final String moduleUrl, final PrintStream stream) {
51  3 this.moduleUrl = moduleUrl;
52  3 this.out = stream;
53    }
54   
55    /**
56    * Set output stream.
57    *
58    * @param stream Output stream.
59    */
 
60  0 toggle public final void setPrintStream(final PrintStream stream) {
61  0 this.out = stream;
62    }
63   
 
64  52 toggle public final void logMessageState(final String text) {
65  52 out.println(moduleUrl);
66  52 out.println(DateUtility.getTimestamp() + " state: " + text);
67    }
68   
69    }