001: /**
002: * JavaGuard -- an obfuscation package for Java classfiles.
003: *
004: * Copyright (c) 2002 Thorsten Heit (theit@gmx.de)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2 of the License, or (at your option) any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * The author may be contacted at theit@gmx.de.
021: *
022: *
023: * $Id: Log.java,v 1.2 2002/04/23 11:18:39 glurk Exp $
024: */package net.sf.javaguard.log;
025:
026: /** Contains common constants used by the logger classes.
027: *
028: * @author <a href="mailto:theit@gmx.de">Thorsten Heit</a>
029: */
030: public interface Log {
031: /** The <code>int</code> value representing a normal logging level. */
032: public static final int NORMAL = 0;
033: /** The <code>int</code> value representing an informational logging level. */
034: public static final int INFO = 1;
035: /** The <code>int</code> value representing a verbose logging level. */
036: public static final int VERBOSE = 2;
037: /** The <code>int</code> value representing a debug logging level. */
038: public static final int DEBUG = 3;
039:
040: /** Sets the logging level. Future log messages must have a logging level
041: * equal or higher to the one specified in the parameter.
042: * @param level the new logging level; one of the constants
043: * <code>NORMAL</code>, <code>INFO</code>, <code>VERBOSE</code> or <code>DEBUG</code>
044: * @see #getLoggingLevel
045: */
046: public void setLoggingLevel(int level);
047:
048: /** Returns the current logging level.
049: * @return the current logging level
050: */
051: public int getLoggingLevel();
052:
053: /** Increment the current logging level to be more verbose.
054: */
055: public void incrementLoggingLevel();
056:
057: /** Prints an empty line to the logger using the <code>NORMAL</code> logging
058: * level.
059: * @see #log
060: */
061: public void println();
062:
063: /** Prints the given string to the logger using the <code>NORMAL</code>
064: * logging level and terminates the current line.
065: * @param msg the message to log
066: */
067: public void println(String msg);
068:
069: /** Prints the given string to the logger using the <code>NORMAL</code>
070: * logging level.
071: * @param msg the message to log
072: */
073: public void print(String msg);
074:
075: /** Prints the given string to the logger using the <code>NORMAL</code>
076: * logging level and terminates the current line.
077: * @param msg the message to log
078: */
079: public void log(String msg);
080:
081: /** Prints a logging message and terminates the line if the specified logging
082: * level is lower or equal than the current logging level.
083: * @param level the logging level
084: * @param msg the log message
085: */
086: public void log(int level, String msg);
087:
088: /** Prints a logging message if the specified logging level is lower or equal
089: * than the current logging level. Depending on the <code>lineFeed</code>
090: * parameter the output line is terminated.
091: * @param level the logging level
092: * @param msg the log message
093: * @param lineFeed true if the output line is terminated; false else
094: */
095: public void log(int level, String msg, boolean lineFeed);
096:
097: /** Logs the stack trace of the given exception.
098: * @param ex the exception whose stack trace should be logged
099: */
100: public void printStackTrace(Exception ex);
101: }
|