Tour API Demos Download Tests
Aperture version 1.0
Generated by: JsDoc Toolkit 2.4.0

Namespace aperture.log

Aperture logging API. Multiple appenders can be added to log to different destinations at a specified minimum log level. The logWindowErrors function can be configured to log unhandled JavaScript errors as well. Logging can be configured in the aperture config file (see example) or programmatically.

Namespace Summary
Constructor Attributes Constructor Name and Description
 

Method Summary

Namespace Detail

aperture.log
// example aperture config file section 
aperture.log : {
  level : 'info',
  logWindowErrors : {log: true, preventDefault: true},
    appenders : {
      consoleAppender : {level: 'info'},
      notifyAppender : {level: 'error'}
  }
}

Method Detail

  • <static> {aperture.log.Appender} aperture.log.addAjaxAppender(spec)

    Creates and adds an AJAX appender object. The AJAX Appender POSTs log messages to a provided end-point URI using a JSON format. Log messages are buffered on the client side and only sent to the server once every N seconds where N is settable upon construction.

    The data will be posted with the following format:

    [
    { level:"warn", message:"A log message", when:"2011-09-02T17:57:33.692Z" },
    { level:"error", data:{some:"data"}, when:"2011-09-02T17:57:34.120Z" }
    ]
    

    Defined in: AjaxAppender.js.
    Parameters:
    {Object} spec
    specification object describing the properties of the ajax appender to build
    {String} spec.url
    the server endpoint to which log messages will be POSTed.
    {Number} spec.timeout Optional
    period in milliseconds between when collected log messages are sent to the server. Defaults to 3000
    {aperture.log.LEVEL} spec.level Optional
    initial appender logging threshold level, defaults to WARN
    Returns:
    {aperture.log.Appender} a new AJAX appender object that has been added to the logging system
  • <static> {aperture.log.Appender} aperture.log.addAlertBoxAppender(spec)
    Creates and adds an alert box implementation of a logging Appender to the logging system. Pops up an alert box for every log message that passes the appender's threshold. By default the threshold is set to ERROR to ensure alert boxes rarely appear.
    Defined in: AlertBoxAppender.js.
    Parameters:
    {Object} spec Optional
    specification object describing the properties of the appender
    {aperture.log.LEVEL} spec.level Optional
    initial appender logging threshold level, defaults to ERROR
    Returns:
    {aperture.log.Appender} a new alert box appender instance
  • <static> aperture.log.addAppender(toAdd)
    Adds an Appender instance to the set of active logging appenders
    Parameters:
    {Appender} toAdd
    an appender instance to add
    Returns:
    the added appender
  • <static> {aperture.log.Appender} aperture.log.addBufferingAppender(spec)
    Creates and adds a buffering appender to the logging system. This appender stores most recent N log messages internally and provides a list of them on demand via a 'getBuffer' function.
    Defined in: BufferingAppender.js.
    Parameters:
    {Object} spec Optional
    specification object describing how this appender should be constructed.
    {Number} spec.bufferDepth Optional
    maximum number of log records to keep in the buffer, defaults to 100
    {aperture.log.LEVEL} spec.level Optional
    initial appender logging threshold level, defaults to INFO
    Returns:
    {aperture.log.Appender} a new buffering appender instance
  • <static> {aperture.log.Appender} aperture.log.addConsoleAppender(spec)
    Creates and adds a console implementation of a logging Appender to the logging system. This appender works as follows:
    1. If firebug exists, it will be used
    2. If console.error, console.warn, console.info and console.debug exist, they will be called as appropriate
    3. If they do not exist console.log will be called
    4. If console.log or console do not exist, this appender does nothing

    Defined in: ConsoleAppender.js.
    Parameters:
    {Object} spec Optional
    specification object describing the properties of the appender
    {aperture.log.LEVEL} spec.level Optional
    initial appender logging threshold level, defaults to INFO
    Returns:
    {aperture.log.Appender} a new console appender instance
  • <static> {aperture.log.Appender} aperture.log.addDomAppender(spec)
    Creates and adds a DOM appender to the logging system. The DOM Appender logs all messages to a given dom element. The given DOM element will have an ordered list of log messages and a "Clear" button added to it. Log messages will be styled 'li' tags with the class 'aperture-log-#' where # is the log level, one of 'error', 'warn', 'info', 'debug', or 'log'. The list itself will have the class 'aperture-log-display' and the button will have the class 'aperture-log-clear'.
    Defined in: DOMAppender.js.
    Parameters:
    {Object} spec
    specification object describing the properties of the appender
    {Element} spec.container
    the DOM element or selector string to the DOM element that should be used to log all messages.
    {aperture.log.LEVEL} spec.level Optional
    initial appender logging threshold level, defaults to INFO
    Returns:
    {aperture.log.Appender} a new DOM appender instance
  • <static> {aperture.log.Appender} aperture.log.addNotifyAppender(spec)
    Creates and adds a notification appender to the logging system. The Notify Appender logs all messages to a panel attached to the document body (or other container), typically at the bottom of the screen. The panel pops up whenever a new message is logged at the required minimum log level and has an ordered list of log messages with "Clear" and "Close" buttons. The components of the console REQUIRE CSS styles for proper appearance. Log messages may also optionally be styled by level. Here is an model CSS file for NotifyAppender.
    Defined in: NotifyAppender.js.
    Parameters:
    {Object} spec
    specification object describing the properties of the appender.
    {String} spec.parentId Optional
    the optional DOM id of the parent for the notify panel, which defaults to body.
    {aperture.log.LEVEL} spec.level Optional
    the optional initial appender logging threshold level, which defaults to ERROR.
    Returns:
    {aperture.log.Appender} a new Notify appender instance
  • <static> aperture.log.appenders()
    Returns a list of the current logging appenders
    Returns:
    an array of active appenders
  • <static> aperture.log.error(message)
    Logs a message at the "LEVEL.ERROR" level
    Parameters:
    {String|Object} message
    a message or object to log. The message may be a plain string, may be a format string followed by values to inject into the string, or may be one or more objects that should be logged as is.
    {String|Object} ... Optional
    additional objects to log or parameters for the format string contained in the message parameter.
  • <static> {String} aperture.log.indent(spaces)
    If setting increments or decrements the indent by the specified number of spaces, otherwise returning the current indentation as a string of spaces. Zero may be supplied as an argument to reset the indentation to zero.
    Parameters:
    {Number} spaces Optional
    the number of spaces to increment or decrement, or zero to reset.
    Returns:
    {String} the current indentation as a string.
  • <static> aperture.log.info(message)
    Logs a message at the "LEVEL.INFO" level
    Parameters:
    {String|Object} message
    a message or object to log. The message may be a plain string, may be a format string followed by values to inject into the string, or may be one or more objects that should be logged as is.
    {String|Object} ... Optional
    additional objects to log or parameters for the format string contained in the message parameter.
  • <static> {Boolean} aperture.log.isLogging(level)
    Returns true if configured to include the specified log level.
    Parameters:
    {LEVEL} level
    Returns:
    {Boolean} true if logging the specified level.
  • <static> {LEVEL} aperture.log.level(l)
    Sets or gets the current global logging level
    Parameters:
    {LEVEL} l Optional
    if provided, sets the global logging level
    Returns:
    {LEVEL} the global logging level, if a get, the old logging level if a set
  • <static> aperture.log.log(message)
    Logs a message at the "LEVEL.LOG" level
    Parameters:
    {String|Object} message
    a message or object to log. The message may be a plain string, may be a format string followed by values to inject into the string, or may be one or more objects that should be logged as is.
    {String|Object} ... Optional
    additional objects to log or parameters for the format string contained in the message parameter.
  • <static> aperture.log.logAtLevel(level, message)
    Logs a message at the given level
    Parameters:
    {aperture.log.LEVEL} level
    the level at which to log the given message
    {String|Object} message
    a message or object to log. The message may be a plain string, may be a format string followed by values to inject into the string, or may be one or more objects that should be logged as is.
    {String|Object} ... Optional
    additional objects to log or parameters for the format string contained in the message parameter.
  • <static> aperture.log.logWindowErrors(log, preventDefault)
    Specifies whether or not to intercept and log Javascript errors, or if no arguments are supplied returns true or false indicating the current state.
    Parameters:
    {Boolean} log Optional
    whether or not to log window errors.
    {Boolean} preventDefault Optional, Default: false
    whether or not to prevent the browser's default.
  • <static> aperture.log.removeAppender(toRemove)
    Removes an Appender instance from the set of active logging appenders
    Parameters:
    {Appender} toRemove
    an appender instance currently in the list of active appenders that should be removed
    Returns:
    the removed appender
  • <static> aperture.log.warn(message)
    Logs a message at the "LEVEL.WARN" level
    Parameters:
    {String|Object} message
    a message or object to log. The message may be a plain string, may be a format string followed by values to inject into the string, or may be one or more objects that should be logged as is.
    {String|Object} ... Optional
    additional objects to log or parameters for the format string contained in the message parameter.