Package org.apache.velocity.runtime.log
Class Log
- java.lang.Object
-
- org.apache.velocity.runtime.log.Log
-
- Direct Known Subclasses:
LogDisplayWrapper,RuntimeLoggerLog
public class Log extends java.lang.ObjectConvenient wrapper for LogChute functions. This implements the RuntimeLogger methods (and then some). It is hoped that use of this will fully replace use of the RuntimeLogger.- Since:
- 1.5
- Version:
- $Id: Log.java 724804 2008-12-09 18:17:08Z nbubna $
- Author:
- Nathan Bubna
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddebug(java.lang.Object message)Log a debug message.voiddebug(java.lang.Object message, java.lang.Throwable t)Log a debug message and accompanying Throwable.voiderror(java.lang.Object message)Log an error message.voiderror(java.lang.Object message, java.lang.Throwable t)Log an error message and accompanying Throwable.static java.lang.StringformatFileString(java.lang.String template, int linenum, int colnum)Simply creates a string that formats the template filename with line number and column.static java.lang.StringformatFileString(Directive directive)Creates a string that formats the template filename with line number and column of the given Directive.static java.lang.StringformatFileString(Node node)Creates a string that formats the template filename with line number and column of the given Node.static java.lang.StringformatFileString(Info info)Simply creates a string that formats the template filename with line number and column.protected LogChutegetLogChute()Returns the LogChute wrapped by this Log instance.voidinfo(java.lang.Object message)Log an info message.voidinfo(java.lang.Object message, java.lang.Throwable t)Log an info message and accompanying Throwable.booleanisDebugEnabled()Returns true if debug level messages will be printed by the LogChute.booleanisErrorEnabled()Returns true if error level messages will be printed by the LogChute.booleanisInfoEnabled()Returns true if info level messages will be printed by the LogChute.booleanisTraceEnabled()Returns true if trace level messages will be printed by the LogChute.booleanisWarnEnabled()Returns true if warn level messages will be printed by the LogChute.protected voidlog(int level, java.lang.Object message)protected voidlog(int level, java.lang.Object message, java.lang.Throwable t)protected voidsetLogChute(LogChute chute)Updates the LogChute wrapped by this Log instance.voidtrace(java.lang.Object message)Log a trace message.voidtrace(java.lang.Object message, java.lang.Throwable t)Log a trace message and accompanying Throwable.voidwarn(java.lang.Object message)Log a warning message.voidwarn(java.lang.Object message, java.lang.Throwable t)Log a warning message and accompanying Throwable.
-
-
-
Constructor Detail
-
Log
public Log()
Creates a new Log that wraps a HoldingLogChute.
-
Log
public Log(LogChute chute)
Creates a new Log that wraps the specified LogChute.- Parameters:
chute-
-
-
Method Detail
-
setLogChute
protected void setLogChute(LogChute chute)
Updates the LogChute wrapped by this Log instance.- Parameters:
chute- The new value for the log chute.
-
getLogChute
protected LogChute getLogChute()
Returns the LogChute wrapped by this Log instance.- Returns:
- The LogChute wrapped by this Log instance.
-
log
protected void log(int level, java.lang.Object message)
-
log
protected void log(int level, java.lang.Object message, java.lang.Throwable t)
-
isTraceEnabled
public boolean isTraceEnabled()
Returns true if trace level messages will be printed by the LogChute.- Returns:
- If trace level messages will be printed by the LogChute.
-
trace
public void trace(java.lang.Object message)
Log a trace message.- Parameters:
message-
-
trace
public void trace(java.lang.Object message, java.lang.Throwable t)Log a trace message and accompanying Throwable.- Parameters:
message-t-
-
isDebugEnabled
public boolean isDebugEnabled()
Returns true if debug level messages will be printed by the LogChute.- Returns:
- True if debug level messages will be printed by the LogChute.
-
debug
public void debug(java.lang.Object message)
Log a debug message.- Parameters:
message-
-
debug
public void debug(java.lang.Object message, java.lang.Throwable t)Log a debug message and accompanying Throwable.- Parameters:
message-t-
-
isInfoEnabled
public boolean isInfoEnabled()
Returns true if info level messages will be printed by the LogChute.- Returns:
- True if info level messages will be printed by the LogChute.
-
info
public void info(java.lang.Object message)
Log an info message.- Parameters:
message-
-
info
public void info(java.lang.Object message, java.lang.Throwable t)Log an info message and accompanying Throwable.- Parameters:
message-t-
-
isWarnEnabled
public boolean isWarnEnabled()
Returns true if warn level messages will be printed by the LogChute.- Returns:
- True if warn level messages will be printed by the LogChute.
-
warn
public void warn(java.lang.Object message)
Log a warning message.- Parameters:
message-
-
warn
public void warn(java.lang.Object message, java.lang.Throwable t)Log a warning message and accompanying Throwable.- Parameters:
message-t-
-
isErrorEnabled
public boolean isErrorEnabled()
Returns true if error level messages will be printed by the LogChute.- Returns:
- True if error level messages will be printed by the LogChute.
-
error
public void error(java.lang.Object message)
Log an error message.- Parameters:
message-
-
error
public void error(java.lang.Object message, java.lang.Throwable t)Log an error message and accompanying Throwable.- Parameters:
message-t-
-
formatFileString
public static final java.lang.String formatFileString(Directive directive)
Creates a string that formats the template filename with line number and column of the given Directive. We use this routine to provide a cosistent format for displaying file errors.
-
formatFileString
public static final java.lang.String formatFileString(Node node)
Creates a string that formats the template filename with line number and column of the given Node. We use this routine to provide a cosistent format for displaying file errors.
-
formatFileString
public static final java.lang.String formatFileString(Info info)
Simply creates a string that formats the template filename with line number and column. We use this routine to provide a cosistent format for displaying file errors.
-
formatFileString
public static final java.lang.String formatFileString(java.lang.String template, int linenum, int colnum)Simply creates a string that formats the template filename with line number and column. We use this routine to provide a cosistent format for displaying file errors.- Parameters:
template- File name of template, can be nulllinenum- Line number within the filecolnum- Column number withing the file at linenum
-
-