Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Do Jan 11 2007 09:03:50 CET
file stats: LOC: 249   Methods: 17
NCLOC: 85   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
Trace.java - 46,2% 52,9% 48,8%
coverage coverage
 1    /* $Id: Trace.java,v 1.10 2006/10/20 20:23:07 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2006, 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.log;
 19   
 20    import org.apache.commons.logging.Log;
 21    import org.apache.commons.logging.LogFactory;
 22   
 23   
 24    /**
 25    * Developer trace.
 26    *
 27    * @version $Revision: 1.10 $
 28    * @author Michael Meyling
 29    */
 30    public final class Trace {
 31   
 32    /**
 33    * Constructor.
 34    */
 35  0 private Trace() {
 36    // don't call me
 37    }
 38   
 39    /**
 40    * Trace object.
 41    *
 42    * @param tracingObject Instance that wants to make a trace entry.
 43    * @param method Method of that object.
 44    * @param object Object to trace.
 45    */
 46  285389 public static void trace(final Object tracingObject, final String method,
 47    final Object object) {
 48  285389 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 49    + "." + method);
 50  285389 log.debug(object);
 51    }
 52   
 53    /**
 54    * Trace object.
 55    *
 56    * @param tracingClass Class that wants to make a trace entry.
 57    * @param method Method of that class.
 58    * @param object Object to trace.
 59    */
 60  6615 public static void trace(final Class tracingClass, final String method,
 61    final Object object) {
 62  6615 final Log log = LogFactory.getFactory().getInstance(tracingClass
 63    + "." + method);
 64  6615 log.debug(method + ":" + object);
 65    }
 66   
 67    /**
 68    * Trace throwable.
 69    *
 70    * @param tracingObject Instance that wants to make a trace entry.
 71    * @param method Method of that object.
 72    * @param throwable Throwable to trace.
 73    */
 74  1 public static void trace(final Object tracingObject, final String method,
 75    final Throwable throwable) {
 76  1 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 77    + "." + method);
 78  1 log.debug(throwable, throwable);
 79    }
 80   
 81    /**
 82    * Trace throwable.
 83    *
 84    * @param tracingClass Class that wants to make a trace entry.
 85    * @param method Method of that class.
 86    * @param throwable Throwable to trace.
 87    */
 88  0 public static void trace(final Class tracingClass, final String method,
 89    final Throwable throwable) {
 90  0 final Log log = LogFactory.getFactory().getInstance(tracingClass
 91    + "." + method);
 92  0 log.debug(throwable, throwable);
 93    // printClassMethod(tracingClass, method);
 94    // out.println(throwable);
 95    // throwable.printStackTrace(out);
 96    }
 97   
 98    /**
 99    * Trace throwable and extra description.
 100    *
 101    * @param tracingObject Instance that wants to make a trace entry.
 102    * @param method Method of that object.
 103    * @param description Further information.
 104    * @param throwable Throwable to trace.
 105    */
 106  0 public static void trace(final Object tracingObject, final String method,
 107    final String description, final Throwable throwable) {
 108  0 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 109    + "." + method);
 110  0 log.debug(description, throwable);
 111    }
 112   
 113    /**
 114    * Trace throwable and extra description.
 115    *
 116    * @param tracingClass Class that wants to make a trace entry.
 117    * @param method Method of that class.
 118    * @param description Further information.
 119    * @param throwable Throwable to trace.
 120    */
 121  0 public static void trace(final Class tracingClass, final String method,
 122    final String description, final Throwable throwable) {
 123  0 final Log log = LogFactory.getFactory().getInstance(tracingClass
 124    + "." + method);
 125  0 log.debug(description, throwable);
 126    }
 127   
 128    /**
 129    * Trace method begin. Should be followed by an analogous
 130    * {@link #end(Object, String)} call.
 131    *
 132    * @param tracingObject Instance that wants to make a trace entry.
 133    * @param method Method of that object.
 134    */
 135  12449 public static void begin(final Object tracingObject, final String method) {
 136  12449 trace(tracingObject, method, "begin");
 137    }
 138   
 139    /**
 140    * Trace method begin. Should be followed by an analogous {@link #end(Class, String)} call.
 141    *
 142    * @param tracingClass Class that wants to make a trace entry.
 143    * @param method Method of that class.
 144    */
 145  92 public static void begin(final Class tracingClass, final String method) {
 146  92 trace(tracingClass, method, "begin");
 147    }
 148   
 149    /**
 150    * Trace method end.
 151    *
 152    * @param tracingObject Instance that wants to make a trace entry.
 153    * @param method Method of that object.
 154    */
 155  12280 public static void end(final Object tracingObject, final String method) {
 156  12280 trace(tracingObject, method, "end");
 157    }
 158   
 159    /**
 160    * Trace method end.
 161    *
 162    * @param tracingClass Class that wants to make a trace entry.
 163    * @param method Method of that class.
 164    */
 165  92 public static void end(final Class tracingClass, final String method) {
 166  92 trace(tracingClass, method, "end");
 167    }
 168   
 169    /**
 170    * Trace parameter.
 171    *
 172    * @param tracingObject Instance that wants to make a trace entry.
 173    * @param method Method of that object.
 174    * @param param Parameter to trace.
 175    * @param value Value of parameter.
 176    */
 177  248349 public static void param(final Object tracingObject, final String method,
 178    final String param, final Object value) {
 179  248349 trace(tracingObject, method, param + "=" + value);
 180    }
 181   
 182    /**
 183    * Trace parameter.
 184    *
 185    * @param tracingClass Class that wants to make a trace entry.
 186    * @param method Method of that class.
 187    * @param param Parameter to trace.
 188    * @param value Value of parameter.
 189    */
 190  6431 public static void param(final Class tracingClass, final String method,
 191    final String param, final Object value) {
 192  6431 trace(tracingClass, method, param + "=" + value);
 193    }
 194   
 195    /**
 196    * Trace parameter.
 197    *
 198    * @param tracingObject Instance that wants to make a trace entry.
 199    * @param method Method of that object.
 200    * @param param Parameter to trace.
 201    * @param value Value of parameter.
 202    */
 203  0 public static void param(final Object tracingObject, final String method,
 204    final String param, final int value) {
 205  0 trace(tracingObject, method, param + "=" + value);
 206    }
 207   
 208    /**
 209    * Trace parameter.
 210    *
 211    * @param tracingClass Class that wants to make a trace entry.
 212    * @param method Method of that class.
 213    * @param param Parameter to trace.
 214    * @param value Value of parameter.
 215    */
 216  0 public static void param(final Class tracingClass, final String method,
 217    final String param, final int value) {
 218  0 trace(tracingClass, method, param + "=" + value);
 219    }
 220   
 221    /**
 222    * Write stacktrace into trace.
 223    *
 224    * @param tracingObject Instance that wants to make a trace entry.
 225    * @param method Method of that object.
 226    */
 227  0 public static void traceStack(final Object tracingObject, final String method) {
 228  0 try {
 229  0 throw new Exception("Stacktrace");
 230    } catch (Exception e) {
 231  0 trace(tracingObject, method, e);
 232    }
 233    }
 234   
 235    /**
 236    * Write stacktrace into trace.
 237    *
 238    * @param tracingClass Class that wants to make a trace entry.
 239    * @param method Method of that class.
 240    */
 241  0 public static final void traceStack(final Class tracingClass, final String method) {
 242  0 try {
 243  0 throw new Exception("Stacktrace");
 244    } catch (Exception e) {
 245  0 trace(tracingClass, method, e);
 246    }
 247    }
 248   
 249    }