Class TreeLogger
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classProvides extra information to the user, generally details of what caused the problem or what the user should do to fix the problem.static enumA type-safe enum of all possible logging severity types. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TreeLogger.TypeLogs everything -- quite a bit of stuff.static final TreeLogger.TypeLogs detailed information that could be useful during debugging.static final TreeLogger.TypeLogs an error.static final TreeLogger.TypeLogs information.static final TreeLoggerA valid logger that ignores all messages.static final TreeLogger.TypeLogs extremely verbose and detailed information that is typically useful only to product implementors.static final TreeLogger.TypeLogs information related to lower-level operation.static final TreeLogger.TypeLogs a warning. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal TreeLoggerbranch(TreeLogger.Type type, String msg) Callsbranch(com.google.gwt.core.ext.TreeLogger.Type, String, Throwable, com.google.gwt.core.ext.TreeLogger.HelpInfo)with anullcaughtandhelpInfo.final TreeLoggerbranch(TreeLogger.Type type, String msg, Throwable caught) Callsbranch(com.google.gwt.core.ext.TreeLogger.Type, String, Throwable, com.google.gwt.core.ext.TreeLogger.HelpInfo)with anullhelpInfo.abstract TreeLoggerbranch(TreeLogger.Type type, String msg, Throwable caught, TreeLogger.HelpInfo helpInfo) Produces a branched logger, which can be used to write messages that are logically grouped together underneath the current logger.abstract booleanisLoggable(TreeLogger.Type type) Determines whether or not a log entry of the specified type would actually be logged.final voidlog(TreeLogger.Type type, String msg) final voidlog(TreeLogger.Type type, String msg, Throwable caught) abstract voidlog(TreeLogger.Type type, String msg, Throwable caught, TreeLogger.HelpInfo helpInfo) Logs a message and/or an exception, with optional help info.
-
Field Details
-
ERROR
Logs an error. -
WARN
Logs a warning. -
INFO
Logs information. -
TRACE
Logs information related to lower-level operation. -
DEBUG
Logs detailed information that could be useful during debugging. -
SPAM
Logs extremely verbose and detailed information that is typically useful only to product implementors. -
ALL
Logs everything -- quite a bit of stuff. -
NULL
A valid logger that ignores all messages. Occasionally useful when calling methods that require a logger parameter.
-
-
Constructor Details
-
TreeLogger
public TreeLogger()
-
-
Method Details
-
branch
Callsbranch(com.google.gwt.core.ext.TreeLogger.Type, String, Throwable, com.google.gwt.core.ext.TreeLogger.HelpInfo)with anullcaughtandhelpInfo. -
branch
Callsbranch(com.google.gwt.core.ext.TreeLogger.Type, String, Throwable, com.google.gwt.core.ext.TreeLogger.HelpInfo)with anullhelpInfo. -
branch
public abstract TreeLogger branch(TreeLogger.Type type, String msg, Throwable caught, TreeLogger.HelpInfo helpInfo) Produces a branched logger, which can be used to write messages that are logically grouped together underneath the current logger. The details of how/if the resulting messages are displayed is implementation-dependent.The log message supplied when branching serves two purposes. First, the message should be considered a heading for all the child messages below it. Second, the
typeof the message provides a hint as to the importance of the children below it. As an optimization, an implementation could return a "no-op" logger if messages of the specified type weren't being logged, which the implication being that all nested log messages were no more important than the level of their branch parent.As an example of how hierarchical logging can be used, a branched logger in a GUI could write log message as child items of a parent node in a tree control. If logging to streams, such as a text console, the branched logger could prefix each entry with a unique string and indent its text so that it could be sorted later to reconstruct a proper hierarchy.
- Parameters:
type-msg- an optional message to log, which can benullif only an exception is being loggedcaught- an optional exception to log, which can benullif only a message is being loggedhelpInfo- extra information that might be used by the logger to provide extended information to the user- Returns:
- an instance of
TreeLoggerrepresenting the new branch of the log; may be the same instance on which this method is called
-
isLoggable
Determines whether or not a log entry of the specified type would actually be logged. Caller use this method to avoid constructing log messages that would be thrown away. -
log
-
log
-
log
public abstract void log(TreeLogger.Type type, String msg, Throwable caught, TreeLogger.HelpInfo helpInfo) Logs a message and/or an exception, with optional help info. It is also legal to call this method usingnullarguments for bothmsgandcaught, in which case the log event can be ignored. Theinfocan provide extra information to the logger; a logger may choose to ignore this info.- Parameters:
type-msg- an optional message to log, which can benullif only an exception is being loggedcaught- an optional exception to log, which can benullif only a message is being loggedhelpInfo- extra information that might be used by the logger to provide extended information to the user
-