public abstract class AbstractTreeLogger extends TreeLogger
TreeLogger.HelpInfo, TreeLogger.Type
Modifier and Type | Field and Description |
---|---|
static Comparator<String> |
LOG_LINE_COMPARATOR |
protected TreeLogger.Type |
logLevel |
protected AbstractTreeLogger |
parent |
Modifier | Constructor and Description |
---|---|
protected |
AbstractTreeLogger()
The constructor used when creating a top-level logger.
|
Modifier and Type | Method and Description |
---|---|
protected int |
allocateNextChildIndex() |
TreeLogger |
branch(TreeLogger.Type type,
String msg,
Throwable caught,
TreeLogger.HelpInfo helpInfo)
Implements branching behavior that supports lazy logging for low-priority
branched loggers.
|
protected void |
commitMyBranchEntryInMyParentLogger()
Commits the branch after ensuring that the parent logger (if there is one)
has been committed first.
|
protected abstract AbstractTreeLogger |
doBranch()
Derived classes should override this method to return a branched logger.
|
protected abstract void |
doCommitBranch(AbstractTreeLogger childBeingCommitted,
TreeLogger.Type type,
String msg,
Throwable caught,
TreeLogger.HelpInfo helpInfo)
Derived classes should override this method to actually commit the
specified message associated with this the root of this branch.
|
protected abstract void |
doLog(int indexOfLogEntryWithinParentLogger,
TreeLogger.Type type,
String msg,
Throwable caught,
TreeLogger.HelpInfo helpInfo)
Derived classes should override this method to actually write a log
message.
|
int |
getBranchedIndex() |
protected static String |
getExceptionName(Throwable e) |
TreeLogger.Type |
getMaxDetail() |
MetricMap |
getMetricMap()
Returns the MetricMap currently associated with this TreeLogger.
|
AbstractTreeLogger |
getParentLogger() |
static String |
getStackTraceAsString(Throwable e) |
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)
Immediately logs or ignores the specified messages, based on the specified
message type and this logger's settings.
|
void |
resetMetricMap()
Clears this logger's MetricMap.
|
void |
setAmount(MetricName name,
long amount)
A metric's value should normally be set using
MetricName.setAmount(com.google.gwt.core.ext.TreeLogger, long) . |
void |
setMaxDetail(TreeLogger.Type type) |
String |
toString() |
branch, branch, log, log
public static final Comparator<String> LOG_LINE_COMPARATOR
protected TreeLogger.Type logLevel
protected AbstractTreeLogger parent
protected AbstractTreeLogger()
public final TreeLogger branch(TreeLogger.Type type, String msg, Throwable caught, TreeLogger.HelpInfo helpInfo)
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 void resetMetricMap()
public final int getBranchedIndex()
public MetricMap getMetricMap()
public final TreeLogger.Type getMaxDetail()
public final AbstractTreeLogger getParentLogger()
public final boolean isLoggable(TreeLogger.Type type)
TreeLogger
isLoggable
in class TreeLogger
public final void log(TreeLogger.Type type, String msg, Throwable caught, TreeLogger.HelpInfo helpInfo)
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 final void setMaxDetail(TreeLogger.Type type)
type
- the log type representing the most detailed level of logging
that the caller is interested in, or null
to choose
the default level.protected int allocateNextChildIndex()
protected void commitMyBranchEntryInMyParentLogger()
protected abstract AbstractTreeLogger doBranch()
protected abstract void doCommitBranch(AbstractTreeLogger childBeingCommitted, TreeLogger.Type type, String msg, Throwable caught, TreeLogger.HelpInfo helpInfo)
protected abstract void doLog(int indexOfLogEntryWithinParentLogger, TreeLogger.Type type, String msg, Throwable caught, TreeLogger.HelpInfo helpInfo)
isLoggable(TreeLogger.Type)
will have already
been called.public void setAmount(MetricName name, long amount)
MetricName.setAmount(com.google.gwt.core.ext.TreeLogger, long)
.Copyright © 2018. All rights reserved.