Clover coverage report - QedeqKernelSe Coverage Report
Coverage timestamp: Sa Dez 22 2007 01:35:21 CET
file stats: LOC: 464   Methods: 27
NCLOC: 215   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
Trace.java 54,2% 53,7% 51,9% 53,5%
coverage coverage
 1    /* $Id: Trace.java,v 1.4 2007/09/02 00:13:41 m31 Exp $
 2    *
 3    * This file is part of the project "Hilbert II" - http://www.qedeq.org
 4    *
 5    * Copyright 2000-2007, 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.trace;
 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.4 $
 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  187900 public static void trace(final Object tracingObject, final String method,
 47    final Object object) {
 48  187899 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 49    + "." + method);
 50  187897 if (log.isDebugEnabled()) {
 51  23921 log.debug(object);
 52    }
 53    }
 54   
 55    /**
 56    * Trace object.
 57    *
 58    * @param tracingClass Class that wants to make a trace entry.
 59    * @param method Method of that class.
 60    * @param object Object to trace.
 61    */
 62  0 public static void trace(final Class tracingClass, final String method,
 63    final Object object) {
 64  0 final Log log = LogFactory.getFactory().getInstance(tracingClass
 65    + "." + method);
 66  0 if (log.isDebugEnabled()) {
 67  0 log.debug(object);
 68    }
 69    }
 70   
 71    /**
 72    * Trace throwable.
 73    *
 74    * @param tracingObject Instance that wants to make a trace entry.
 75    * @param method Method of that object.
 76    * @param throwable Throwable to trace.
 77    */
 78  136 public static void trace(final Object tracingObject, final String method,
 79    final Throwable throwable) {
 80  136 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 81    + "." + method);
 82  136 if (log.isDebugEnabled()) {
 83  35 log.debug(throwable, throwable);
 84    }
 85    }
 86   
 87    /**
 88    * Trace throwable.
 89    *
 90    * @param tracingClass Class that wants to make a trace entry.
 91    * @param method Method of that class.
 92    * @param throwable Throwable to trace.
 93    */
 94  0 public static void trace(final Class tracingClass, final String method,
 95    final Throwable throwable) {
 96  0 final Log log = LogFactory.getFactory().getInstance(tracingClass
 97    + "." + method);
 98  0 if (log.isDebugEnabled()) {
 99  0 log.debug(throwable, throwable);
 100    }
 101    }
 102   
 103    /**
 104    * Trace fatal throwable and extra description.
 105    *
 106    * @param tracingObject Instance that wants to make a trace entry.
 107    * @param method Method of that object.
 108    * @param description Further information.
 109    * @param throwable Throwable to trace.
 110    */
 111  10 public static void fatal(final Object tracingObject, final String method,
 112    final String description, final Throwable throwable) {
 113  10 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 114    + "." + method);
 115  10 log.fatal(description, throwable);
 116    }
 117   
 118    /**
 119    * Trace fatal throwable and extra description.
 120    *
 121    * @param tracingClass Class that wants to make a trace entry.
 122    * @param method Method of that class.
 123    * @param description Further information.
 124    * @param throwable Throwable to trace.
 125    */
 126  0 public static void fatal(final Class tracingClass, final String method,
 127    final String description, final Throwable throwable) {
 128  0 final Log log = LogFactory.getFactory().getInstance(tracingClass
 129    + "." + method);
 130  0 log.fatal(description, throwable);
 131    }
 132   
 133    /**
 134    * Trace throwable and extra description.
 135    *
 136    * @param tracingObject Instance that wants to make a trace entry.
 137    * @param method Method of that object.
 138    * @param description Further information.
 139    * @param throwable Throwable to trace.
 140    */
 141  0 public static void trace(final Object tracingObject, final String method,
 142    final String description, final Throwable throwable) {
 143  0 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 144    + "." + method);
 145  0 if (log.isDebugEnabled()) {
 146  0 log.debug(description, throwable);
 147    }
 148    }
 149   
 150    /**
 151    * Trace throwable and extra description.
 152    *
 153    * @param tracingClass Class that wants to make a trace entry.
 154    * @param method Method of that class.
 155    * @param description Further information.
 156    * @param throwable Throwable to trace.
 157    */
 158  0 public static void trace(final Class tracingClass, final String method,
 159    final String description, final Throwable throwable) {
 160  0 final Log log = LogFactory.getFactory().getInstance(tracingClass
 161    + "." + method);
 162  0 if (log.isDebugEnabled()) {
 163  0 log.debug(description, throwable);
 164    }
 165    }
 166   
 167    /**
 168    * Trace method begin. Should be followed by an analogous
 169    * {@link #end(Object, String)} call.
 170    *
 171    * @param tracingObject Instance that wants to make a trace entry.
 172    * @param method Method of that object.
 173    */
 174  29813 public static void begin(final Object tracingObject, final String method) {
 175  29813 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 176    + "." + method);
 177  29813 if (log.isDebugEnabled()) {
 178  2243 log.debug("begin");
 179    }
 180    }
 181   
 182    /**
 183    * Trace method begin. Should be followed by an analogous {@link #end(Class, String)} call.
 184    *
 185    * @param tracingClass Class that wants to make a trace entry.
 186    * @param method Method of that class.
 187    */
 188  119 public static void begin(final Class tracingClass, final String method) {
 189  119 final Log log = LogFactory.getFactory().getInstance(tracingClass
 190    + "." + method);
 191  119 if (log.isDebugEnabled()) {
 192  3 log.debug("begin");
 193    }
 194    }
 195   
 196    /**
 197    * Trace method end.
 198    *
 199    * @param tracingObject Instance that wants to make a trace entry.
 200    * @param method Method of that object.
 201    */
 202  29304 public static void end(final Object tracingObject, final String method) {
 203  29304 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 204    + "." + method);
 205  29304 if (log.isDebugEnabled()) {
 206  2175 log.debug("end");
 207    }
 208    }
 209   
 210    /**
 211    * Trace method end.
 212    *
 213    * @param tracingClass Class that wants to make a trace entry.
 214    * @param method Method of that class.
 215    */
 216  119 public static void end(final Class tracingClass, final String method) {
 217  119 final Log log = LogFactory.getFactory().getInstance(tracingClass
 218    + "." + method);
 219  119 if (log.isDebugEnabled()) {
 220  3 log.debug("end");
 221    }
 222    }
 223   
 224    /**
 225    * Trace message.
 226    *
 227    * @param tracingObject Instance that wants to make a trace entry.
 228    * @param method Method of that object.
 229    * @param message Message.
 230    */
 231  329854 public static void info(final Object tracingObject, final String method,
 232    final String message) {
 233  329854 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 234    + "." + method);
 235  329854 if (log.isInfoEnabled()) {
 236  4869 log.info(message);
 237    }
 238    }
 239   
 240    /**
 241    * Trace method message.
 242    *
 243    * @param tracingClass Class that wants to make a trace entry.
 244    * @param method Method of that class.
 245    * @param message Message.
 246    */
 247  0 public static void info(final Class tracingClass, final String method,
 248    final String message) {
 249  0 final Log log = LogFactory.getFactory().getInstance(tracingClass
 250    + "." + method);
 251  0 if (log.isInfoEnabled()) {
 252  0 log.info(message);
 253    }
 254    }
 255   
 256    /**
 257    * Trace parameter.
 258    *
 259    * @param tracingObject Instance that wants to make a trace entry.
 260    * @param method Method of that object.
 261    * @param param Parameter to trace.
 262    * @param value Value of parameter.
 263    */
 264  7377940 public static void param(final Object tracingObject, final String method,
 265    final String param, final Object value) {
 266  7377907 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 267    + "." + method);
 268  7378435 if (log.isDebugEnabled()) {
 269  362384 log.debug(param + "=" + value);
 270    }
 271    }
 272   
 273    /**
 274    * Trace parameter.
 275    *
 276    * @param tracingClass Class that wants to make a trace entry.
 277    * @param method Method of that class.
 278    * @param param Parameter to trace.
 279    * @param value Value of parameter.
 280    */
 281  185 public static void param(final Class tracingClass, final String method,
 282    final String param, final Object value) {
 283  185 final Log log = LogFactory.getFactory().getInstance(tracingClass
 284    + "." + method);
 285  185 if (log.isDebugEnabled()) {
 286  9 log.debug(param + "=" + value);
 287    }
 288    }
 289   
 290    /**
 291    * Trace parameter.
 292    *
 293    * @param tracingObject Instance that wants to make a trace entry.
 294    * @param method Method of that object.
 295    * @param param Parameter to trace.
 296    * @param value Value of parameter.
 297    */
 298  182611 public static void param(final Object tracingObject, final String method,
 299    final String param, final int value) {
 300  182613 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 301    + "." + method);
 302  182625 if (log.isDebugEnabled()) {
 303  44930 log.debug(param + "=" + value);
 304    }
 305    }
 306   
 307    /**
 308    * Trace parameter.
 309    *
 310    * @param tracingClass Class that wants to make a trace entry.
 311    * @param method Method of that class.
 312    * @param param Parameter to trace.
 313    * @param value Value of parameter.
 314    */
 315  0 public static void param(final Class tracingClass, final String method,
 316    final String param, final int value) {
 317  0 final Log log = LogFactory.getFactory().getInstance(tracingClass
 318    + "." + method);
 319  0 if (log.isDebugEnabled()) {
 320  0 log.debug(param + "=" + value);
 321    }
 322    }
 323   
 324    /**
 325    * Trace parameter.
 326    *
 327    * @param tracingObject Instance that wants to make a trace entry.
 328    * @param method Method of that object.
 329    * @param param Parameter to trace.
 330    * @param value Value of parameter.
 331    */
 332  10377 public static void param(final Object tracingObject, final String method,
 333    final String param, final boolean value) {
 334  10377 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 335    + "." + method);
 336  10377 if (log.isDebugEnabled()) {
 337  1995 log.debug(param + "=" + value);
 338    }
 339    }
 340   
 341    /**
 342    * Trace parameter.
 343    *
 344    * @param tracingClass Class that wants to make a trace entry.
 345    * @param method Method of that class.
 346    * @param param Parameter to trace.
 347    * @param value Value of parameter.
 348    */
 349  0 public static void param(final Class tracingClass, final String method,
 350    final String param, final boolean value) {
 351  0 final Log log = LogFactory.getFactory().getInstance(tracingClass
 352    + "." + method);
 353  0 if (log.isDebugEnabled()) {
 354  0 log.debug(param + "=" + value);
 355    }
 356    }
 357   
 358    /**
 359    * Write stacktrace into trace.
 360    *
 361    * @param tracingObject Instance that wants to make a trace entry.
 362    * @param method Method of that object.
 363    */
 364  467 public static void traceStack(final Object tracingObject, final String method) {
 365  467 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 366    + "." + method);
 367  467 if (!log.isDebugEnabled()) {
 368  318 return;
 369    }
 370  149 try {
 371  149 throw new Exception("Stacktrace");
 372    } catch (Exception e) {
 373  149 log.debug(e, e);
 374    }
 375    }
 376   
 377    /**
 378    * Write stacktrace into trace.
 379    *
 380    * @param tracingClass Class that wants to make a trace entry.
 381    * @param method Method of that class.
 382    */
 383  0 public static final void traceStack(final Class tracingClass, final String method) {
 384  0 final Log log = LogFactory.getFactory().getInstance(tracingClass
 385    + "." + method);
 386  0 if (!log.isDebugEnabled()) {
 387  0 return;
 388    }
 389  0 try {
 390  0 throw new Exception("Stacktrace");
 391    } catch (Exception e) {
 392  0 log.debug(e, e);
 393    }
 394    }
 395   
 396    /**
 397    * Parameter information.
 398    *
 399    * @param tracingObject Instance that wants to make an info entry.
 400    * @param method Method of that object.
 401    * @param param Parameter to trace.
 402    * @param value Value of parameter.
 403    */
 404  395808 public static void paramInfo(final Object tracingObject, final String method,
 405    final String param, final Object value) {
 406  395808 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 407    + "." + method);
 408  395808 if (log.isInfoEnabled()) {
 409  7280 log.info(param + "=" + value);
 410    }
 411    }
 412   
 413    /**
 414    * Parameter information.
 415    *
 416    * @param tracingClass Class that wants to make an info entry.
 417    * @param method Method of that class.
 418    * @param param Parameter to trace.
 419    * @param value Value of parameter.
 420    */
 421  0 public static void paramInfo(final Class tracingClass, final String method,
 422    final String param, final Object value) {
 423  0 final Log log = LogFactory.getFactory().getInstance(tracingClass
 424    + "." + method);
 425  0 if (log.isInfoEnabled()) {
 426  0 log.info(param + "=" + value);
 427    }
 428    }
 429   
 430    /**
 431    * Parameter information.
 432    *
 433    * @param tracingObject Instance that wants to make an info entry.
 434    * @param method Method of that object.
 435    * @param param Parameter to trace.
 436    * @param value Value of parameter.
 437    */
 438  0 public static void paramInfo(final Object tracingObject, final String method,
 439    final String param, final int value) {
 440  0 final Log log = LogFactory.getFactory().getInstance(tracingObject.getClass()
 441    + "." + method);
 442  0 if (log.isInfoEnabled()) {
 443  0 log.info(param + "=" + value);
 444    }
 445    }
 446   
 447    /**
 448    * Parameter information.
 449    *
 450    * @param tracingClass Class that wants to make an info entry.
 451    * @param method Method of that class.
 452    * @param param Parameter to trace.
 453    * @param value Value of parameter.
 454    */
 455  0 public static void paramInfo(final Class tracingClass, final String method,
 456    final String param, final int value) {
 457  0 final Log log = LogFactory.getFactory().getInstance(tracingClass
 458    + "." + method);
 459  0 if (log.isInfoEnabled()) {
 460  0 log.info(param + "=" + value);
 461    }
 462    }
 463   
 464    }