Yahoo! UI Library

Logger Widget  2.6.0

Yahoo! UI Library > logger > YAHOO.widget.Logger

static Class YAHOO.widget.Logger

The singleton Logger class provides core log management functionality. Saves logs written through the global YAHOO.log function or written by a LogWriter instance. Provides access to logs for reading by a LogReader instance or native browser console such as the Firebug extension to Firefox or Safari's JavaScript console through integration with the console.log() method.

Properties

categories - static String[]

Array of categories.
Default Value: ["info","warn","error","time","window"]

loggerEnabled - static Boolean

True if Logger is enabled, false otherwise.
Default Value: true

maxStackEntries - static Number

Upper limit on size of internal stack.
Default Value: 2500

sources - static String[]

Array of sources.
Default Value: ["global"]

Methods

disableBrowserConsole

void disableBrowserConsole ( )
Disables output to the browser's global console.log() function, which is used by the Firebug extension to Firefox as well as Safari.
Returns: void

enableBrowserConsole

void enableBrowserConsole ( )
Enables output to the browser's global console.log() function, which is used by the Firebug extension to Firefox as well as Safari.
Returns: void

getStack

Object[] getStack ( )
Public accessor to internal stack of log message objects.
Returns: Object[]
Array of log message objects.

getStartTime

Date getStartTime ( )
Public accessor to internal start time.
Returns: Date
Internal date of when Logger singleton was initialized.

handleWindowErrors

void handleWindowErrors ( )
Surpresses native JavaScript errors and outputs to console. By default, Logger does not handle JavaScript window error events. NB: Not all browsers support the window.onerror event.
Returns: void

log

void log ( sMsg , sCategory , sSource )
Saves a log message to the stack and fires newLogEvent. If the log message is assigned to an unknown category, creates a new category. If the log message is from an unknown source, creates a new source. If browser console is enabled, outputs the log message to browser console.
Parameters:
sMsg <String> The log message.
sCategory <String> Category of log message, or null.
sSource <String> Source of LogWriter, or null if global.
Returns: void

reset

void reset ( )
Resets internal stack and startTime, enables Logger, and fires logResetEvent.
Returns: void

unhandleWindowErrors

void unhandleWindowErrors ( )
Unsurpresses native JavaScript errors. By default, Logger does not handle JavaScript window error events. NB: Not all browsers support the window.onerror event.
Returns: void

Events

categoryCreateEvent

categoryCreateEvent ( sCategory )
Fired when a new category has been created.
Parameters:
sCategory <String> Category name.

logResetEvent

logResetEvent ( )
Fired when the Logger has been reset has been created.

newLogEvent

newLogEvent ( sMsg )
Fired when a new log message has been created.
Parameters:
sMsg <String> Log message.

sourceCreateEvent

sourceCreateEvent ( sSource )
Fired when a new source has been named.
Parameters:
sSource <String> Source name.


Copyright © 2008 Yahoo! Inc. All rights reserved.