org.hyphenType.debug
Class HTLogger

java.lang.Object
  extended by org.hyphenType.debug.HTLogger

public class HTLogger
extends Object

A logger that only outputs things to a PrintStream if the HYPHEN_TYPE_DEBUG_MODE environment variable is set to true (ignoring case). This class also allows for the user to replace the PrintStream. The default PrintStream is System.out.

Author:
akira

Field Summary
static String HYPHEN_TYPE_DEBUG_MODE
          System environment key to allow for users to change the debug mode when calling the JVM
 
Constructor Summary
HTLogger()
           
 
Method Summary
static boolean debugMode()
           
static void log(String message)
          Logs a message to the PrintStream, if debug mode is true.
static void log(Throwable t)
          Logs the full stack trace of a throwable.
static void setDebugMode(boolean newDebugMode)
          Allows it for programmatic change of the debug mode.
static void setOutput(PrintStream newPs)
          Replaces the PrintStream used by this class to log messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HYPHEN_TYPE_DEBUG_MODE

public static final String HYPHEN_TYPE_DEBUG_MODE
System environment key to allow for users to change the debug mode when calling the JVM

See Also:
Constant Field Values
Constructor Detail

HTLogger

public HTLogger()
Method Detail

log

public static void log(String message)
Logs a message to the PrintStream, if debug mode is true.

Parameters:
message - The message to log

log

public static void log(Throwable t)
Logs the full stack trace of a throwable.

Parameters:
message - The throwable to log

setOutput

public static void setOutput(PrintStream newPs)
Replaces the PrintStream used by this class to log messages. Does nothing if the provided argument is null. If you want this class to stop writing log outputs, you should set the debug mode to false using the method setDebugMode(boolean).

Parameters:
newPs - The new print stream to be used

setDebugMode

public static void setDebugMode(boolean newDebugMode)
Allows it for programmatic change of the debug mode.

Parameters:
newDebugMode - The new debug mode

debugMode

public static boolean debugMode()


Copyright © 2013. All Rights Reserved.