EMMA Coverage Report (generated Fri Feb 14 08:28:31 UTC 2014)
[all classes][org.qedeq.kernel.bo.log]

COVERAGE SUMMARY FOR SOURCE FILE [LogListenerImpl.java]

nameclass, %method, %block, %line, %
LogListenerImpl.java100% (1/1)100% (10/10)97%  (219/225)99%  (41.4/42)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class LogListenerImpl100% (1/1)100% (10/10)97%  (219/225)99%  (41.4/42)
logMessageState (String, String): void 100% (1/1)97%  (29/30)98%  (4.9/5)
logRequest (String, String): void 100% (1/1)97%  (29/30)98%  (4.9/5)
logSuccessfulReply (String, String): void 100% (1/1)97%  (29/30)98%  (4.9/5)
logSuccessfulState (String, String): void 100% (1/1)97%  (29/30)98%  (4.9/5)
logFailureReply (String, String, String): void 100% (1/1)97%  (33/34)98%  (4.9/5)
logFailureState (String, String, String): void 100% (1/1)97%  (33/34)98%  (4.9/5)
LogListenerImpl (): void 100% (1/1)100% (4/4)100% (2/2)
LogListenerImpl (PrintStream): void 100% (1/1)100% (12/12)100% (5/5)
logMessage (String): void 100% (1/1)100% (17/17)100% (3/3)
setPrintStream (PrintStream): void 100% (1/1)100% (4/4)100% (2/2)

1/* This file is part of the project "Hilbert II" - http://www.qedeq.org
2 *
3 * Copyright 2000-2014,  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 
16package org.qedeq.kernel.bo.log;
17 
18import java.io.PrintStream;
19 
20import org.qedeq.base.utility.DateUtility;
21 
22/**
23 * Listener that writes events to a stream.
24 *
25 * @author  Michael Meyling
26 */
27public final class LogListenerImpl implements LogListener {
28 
29    /** Stream for output. */
30    private PrintStream out = System.out;
31 
32    /** For this module we logged the last event. */
33    private String lastModuleUrl = "";
34 
35    /**
36     * Constructor.
37     */
38    public LogListenerImpl() {
39        this(System.out);
40    }
41 
42    /**
43     * Constructor.
44     *
45     * @param   stream  Print to this stream.
46     */
47    public LogListenerImpl(final PrintStream stream) {
48        this.out = stream;
49    }
50 
51    /**
52     * Set output stream.
53     *
54     * @param   stream  Output stream.
55     */
56    public final void setPrintStream(final PrintStream stream) {
57        this.out = stream;
58    }
59 
60    public final void logMessageState(final String text, final String url) {
61        if (!lastModuleUrl.equals(url)) {
62            out.println(url);
63            lastModuleUrl = (url != null ? url : "");
64        }
65        out.println(DateUtility.getTimestamp() + " state:   " + text);
66    }
67 
68    public final void logFailureState(final String text, final String url,
69            final String description) {
70        if (!lastModuleUrl.equals(url)) {
71            out.println(url);
72            lastModuleUrl = (url != null ? url : "");
73        }
74        out.println(DateUtility.getTimestamp() + " failure: " + text + "\n\t"
75            + description);
76    }
77 
78    public final void logSuccessfulState(final String text, final String url) {
79        if (!lastModuleUrl.equals(url)) {
80            out.println(url);
81            lastModuleUrl = (url != null ? url : "");
82        }
83        out.println(DateUtility.getTimestamp() + " success: " + text);
84    }
85 
86    public void logRequest(final String text, final String url) {
87        if (!lastModuleUrl.equals(url)) {
88            out.println(url);
89            lastModuleUrl = (url != null ? url : "");
90        }
91        out.println(DateUtility.getTimestamp() + " request: " + text);
92    }
93 
94    public final void logMessage(final String text) {
95        lastModuleUrl = "";
96        out.println(DateUtility.getTimestamp() + " " + text);
97    }
98 
99 
100    public void logSuccessfulReply(final String text, final String url) {
101        if (!lastModuleUrl.equals(url)) {
102            out.println(url);
103            lastModuleUrl = (url != null ? url : "");
104        }
105        out.println(DateUtility.getTimestamp() + " reply:   " + text);
106    }
107 
108    public void logFailureReply(final String text, final String url, final String description) {
109        if (!lastModuleUrl.equals(url)) {
110            out.println(url);
111            lastModuleUrl = (url != null ? url : "");
112        }
113        out.println(DateUtility.getTimestamp() + " reply:   " + text + "\n\t" + description);
114    }
115 
116}

[all classes][org.qedeq.kernel.bo.log]
EMMA 2.1.5320 (stable) (C) Vladimir Roubtsov