com.google.gwt.libideas.logging.shared
Class LogHandler

java.lang.Object
  extended by com.google.gwt.libideas.logging.shared.LogHandler
Direct Known Subclasses:
ArrayListLogHandler, ConsoleLogHandler, DivLogHandler, FireBugLogHandler, GWTLogHandler, PopupWidgetLogHandler, PrintStreamLogHandler, RemoteLogHandler

public abstract class LogHandler
extends java.lang.Object

A Handler object takes log messages from Logger and publishes them. It is a clone of the Java Logging API. The javadoc below are from the Sun implementation. All handler setup should be guarded by a call to Logger.isLoggingEnabled() A Handler can be disabled by doing a setLevel(Level.OFF) and can be re-enabled by doing a setLevel with an appropriate level.

Since:
1.4
Version:
1.17, 01/12/04

Constructor Summary
LogHandler()
           
 
Method Summary
 void clear()
          Clears the handler if clear is supported.
protected  java.lang.String format(java.lang.String message, Level level, java.lang.String category, java.lang.Throwable e)
          A standard way to present category and level information to string output.
 Level getLevel()
          /** Get the log level specifying which messages will be logged by this Handler.
 void hideHandler()
          Hides the handler, if hiding is supported.
 boolean isSupported()
          Is this handler supported in the given compilation configuration? By default the answer is "yes".
abstract  void publish(java.lang.String message, Level level, java.lang.String category, java.lang.Throwable e)
          publish the message.
 void setLevel(Level newLevel)
          Set the log level specifying which message levels will be logged by this Handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogHandler

public LogHandler()
Method Detail

clear

public void clear()
Clears the handler if clear is supported.


getLevel

public Level getLevel()
/** Get the log level specifying which messages will be logged by this Handler. Message levels lower than this level will be discarded.

Returns:
the level of messages being logged.

hideHandler

public void hideHandler()
Hides the handler, if hiding is supported.


isSupported

public boolean isSupported()
Is this handler supported in the given compilation configuration? By default the answer is "yes".

Returns:
is the handler supported;

publish

public abstract void publish(java.lang.String message,
                             Level level,
                             java.lang.String category,
                             java.lang.Throwable e)
publish the message.

Parameters:
message - the message
level - the message's level
category - optional category
e - optional throwable

setLevel

public void setLevel(Level newLevel)
Set the log level specifying which message levels will be logged by this Handler. Message levels lower than this value will be discarded.

The intention is to allow developers to turn on voluminous logging, but to limit the messages that are sent to certain Handlers.

Parameters:
newLevel - the new value for the log level

format

protected java.lang.String format(java.lang.String message,
                                  Level level,
                                  java.lang.String category,
                                  java.lang.Throwable e)
A standard way to present category and level information to string output.