net.sf.jmp3renamer
Class Logger

java.lang.Object
  extended by net.sf.jmp3renamer.Logger

public class Logger
extends Object

Manages all output. The Logger supports logging levels. So you are able to set a threshold value for logging. The order: OFF DEBUG INFO WARN ERROR FATAL


Field Summary
static int DEBUG
           
static int ERROR
           
static int FATAL
           
private  boolean guiLogging
           
static int INFO
           
private static int level
           
static String[] levelname
           
private static Logger logger
           
private  int nameLength
           
static int OFF
           
private static PrintStream out
           
private  String pattern
           
static int WARN
           
 
Constructor Summary
private Logger()
           
 
Method Summary
 void debug(Object o)
          Logs an object with level DEBUG
 void error(Object o)
          Logs an object with level ERROR
private  String escapeSpecialChars(String value)
          Escapes all special characters of the class java.util.regex.Pattern. !!
 void fatal(Object o)
          Logs an object with level FATAL
static Logger getLogger()
           
 void info(Object o)
          Logs an object with level INFO
private  void log(Object o, int level)
          Logs an object with a given level
static void setLevel(int l)
          Sets the level of the logger.
static void setOutputStream(PrintStream o)
          Sets the OutputStream the logger will write the output to.
 void warn(Object o)
          Logs an object with level WARN
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static Logger logger

OFF

public static final int OFF
See Also:
Constant Field Values

DEBUG

public static final int DEBUG
See Also:
Constant Field Values

INFO

public static final int INFO
See Also:
Constant Field Values

WARN

public static final int WARN
See Also:
Constant Field Values

ERROR

public static final int ERROR
See Also:
Constant Field Values

FATAL

public static final int FATAL
See Also:
Constant Field Values

guiLogging

private final boolean guiLogging
See Also:
Constant Field Values

levelname

public static final String[] levelname

out

private static PrintStream out

level

private static int level

nameLength

private int nameLength

pattern

private String pattern
Constructor Detail

Logger

private Logger()
Method Detail

getLogger

public static Logger getLogger()

setLevel

public static void setLevel(int l)
Sets the level of the logger. All levels below the new one won't be logged anymore.

Parameters:
l - the new level

setOutputStream

public static void setOutputStream(PrintStream o)
Sets the OutputStream the logger will write the output to. Think of System.out, a file or a socket.

Parameters:
o - the new PrintStream

debug

public void debug(Object o)
Logs an object with level DEBUG


info

public void info(Object o)
Logs an object with level INFO


warn

public void warn(Object o)
Logs an object with level WARN


error

public void error(Object o)
Logs an object with level ERROR


fatal

public void fatal(Object o)
Logs an object with level FATAL


log

private void log(Object o,
                 int level)
Logs an object with a given level


escapeSpecialChars

private String escapeSpecialChars(String value)
Escapes all special characters of the class java.util.regex.Pattern. !! Not all chars are escaped at the moment. !! TODO find a method, which does this for us

Parameters:
value -
Returns:
A String object with all Pattern-special-chars escaped