Module ringo/logging
This module provides generic logging support. It uses Apache log4j by default, but can be used with any Logging framework supported by SLF4J.
If the first argument passed to any of the logging methods is a string containing any number of curly bracket pairs ({}), the logger will interpret it as format string and use any following arguments to replace the curly bracket pairs. If an argument is an Error or Java Exception object, the logger will render a stack trace for it and append it to the log message.
Functions
- getInterceptor()
- getLogger(name)
- setConfig(resource)
- setInterceptor(array)
Class Logger
Instance Methods
- debug()
- error()
- info()
- isDebugEnabled()
- isErrorEnabled()
- isInfoEnabled()
- isTraceEnabled()
- isWarnEnabled()
- trace()
- warn()
Logger (name)
Logger class. This constructor is not exported, use this module's {@link getLogger} to get a logger instance.
Parameters
| name |
See
Logger.prototype.debug ()
Logger.prototype.error ()
Logger.prototype.info ()
Logger.prototype.isDebugEnabled ()
Logger.prototype.isErrorEnabled ()
Logger.prototype.isInfoEnabled ()
Logger.prototype.isTraceEnabled ()
Logger.prototype.isWarnEnabled ()
Logger.prototype.trace ()
Log a debug message.
Logger.prototype.warn ()
getInterceptor ()
Return the log message interceptor for the current thread, or null if none is set.
Returns
| the interceptor array |
getLogger (name)
Get a logger for the given name.
Parameters
| string | name | the name of the logger |
Returns
| Logger | a logger instance for the given name |
setConfig (resource)
Configure log4j using the given file resource.
Make sure to set the reset property to true in the log4j:configuration header
e.g.
Parameters
| resource |
setInterceptor (array)
Use array as log message interceptor for the current thread.
Parameters
| array | an array |
