public class CompositeTreeLogger extends TreeLogger
TreeLogger.HelpInfo, TreeLogger.Type
Constructor and Description |
---|
CompositeTreeLogger(TreeLogger... loggers) |
Modifier and Type | Method and Description |
---|---|
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.
|
boolean |
isLoggable(TreeLogger.Type type)
Determines whether or not a log entry of the specified type would actually
be logged.
|
void |
log(TreeLogger.Type type,
String msg,
Throwable caught,
TreeLogger.HelpInfo helpInfo)
Logs a message and/or an exception, with optional help info.
|
void |
setAmount(MetricName name,
long amount)
A metric's value should normally be set using
MetricName.setAmount(com.google.gwt.core.ext.TreeLogger, long) . |
branch, branch, log, log
public CompositeTreeLogger(TreeLogger... loggers)
public TreeLogger branch(TreeLogger.Type type, String msg, Throwable caught, TreeLogger.HelpInfo helpInfo)
TreeLogger
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 type
of 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.
branch
in class TreeLogger
msg
- an optional message to log, which can be null
if
only an exception is being loggedcaught
- an optional exception to log, which can be null
if only a message is being loggedhelpInfo
- extra information that might be used by the logger to
provide extended information to the userTreeLogger
representing the new branch of
the log; may be the same instance on which this method is calledpublic boolean isLoggable(TreeLogger.Type type)
TreeLogger
isLoggable
in class TreeLogger
public void log(TreeLogger.Type type, String msg, Throwable caught, TreeLogger.HelpInfo helpInfo)
TreeLogger
null
arguments for both
msg
and caught
, in which case the log event
can be ignored. The info
can provide extra information to
the logger; a logger may choose to ignore this info.log
in class TreeLogger
msg
- an optional message to log, which can be null
if
only an exception is being loggedcaught
- an optional exception to log, which can be null
if only a message is being loggedhelpInfo
- extra information that might be used by the logger to
provide extended information to the userpublic void setAmount(MetricName name, long amount)
MetricName.setAmount(com.google.gwt.core.ext.TreeLogger, long)
.Copyright © 2018. All rights reserved.