Print Friendly

# Class YAHOO.widget.Logger

Package: | YAHOO.widget
Class: | Logger
Extends: | Object
Defined In: | logger.js

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.

## Public Properties

This class has no public properties.

## Public Methods

Method | Defined By
--- | ---
| disableBrowserConsole() : void | Logger
Disables output to the browser's global console.log() function, which is used by the Firebug extension to Firefox as ...
| enableBrowserConsole() : void | Logger
Enables output to the browser's global console.log() function, which is used by the Firebug extension to Firefox as w...
| getStack() : Object[] | Logger
Public accessor to internal stack of log message objects.
| getStartTime() : Date | Logger
Public accessor to internal start time.
| log(`sMsg {String}`, `sCategory {String}`, `sSource {String}`) : void | Logger
Saves a log message to the stack and fires newLogEvent. If the log message is assigned to an unknown category, create...
| reset() : void | Logger
Resets internal stack and startTime, enables Logger, and fires logResetEvent.

## Public Events

Event | Defined By
--- | ---
| categoryCreateEvent : (`sCategory {String}`) | Logger
Fired when a new category has been created.
| logResetEvent : () | Logger
Fired when the Logger has been reset has been created.
| newLogEvent : (`sMsg {String}`) | Logger
Fired when a new log message has been created.
| sourceCreateEvent : (`sSource {String}`) | Logger
Fired when a new source has been named.

## Method Details

### disableBrowserConsole

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

- None.

Returns:

- `void`

This method is defined by Logger.

### enableBrowserConsole

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

- None.

Returns:

- `void`

This method is defined by Logger.

### getStack

`public function getStack()`
Public accessor to internal stack of log message objects.
Parameters:

- None.

Returns:

- `Object[]`
  Array of log message objects.

This method is defined by Logger.

### getStartTime

`public function getStartTime()`
Public accessor to internal start time.
Parameters:

- None.

Returns:

- `Date`
  Internal date of when Logger singleton was initialized.

This method is defined by Logger.

### log

`public function log(`sMsg {String}`, `sCategory {String}`, `sSource {String}`)`
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:

- `{String}` : sMsg
  The log message.
- `{String}` : sCategory
  Category of log message, or null.
- `{String}` : sSource
  Source of LogWriter, or null if global.

Returns:

- `void`

This method is defined by Logger.

### reset

`public function reset()`
Resets internal stack and startTime, enables Logger, and fires logResetEvent.
Parameters:

- None.

Returns:

- `void`

This method is defined by Logger.

## Event Details

### categoryCreateEvent

`public event categoryCreateEvent`
Fired when a new category has been created.
Subscribers will be called with the following parameters:

- `{String}` : sCategory
  Category name.

This event is defined by Logger.

### logResetEvent

`public event logResetEvent`
Fired when the Logger has been reset has been created.
Subscribers will be called with the following parameters:

- None.

This event is defined by Logger.

### newLogEvent

`public event newLogEvent`
Fired when a new log message has been created.
Subscribers will be called with the following parameters:

- `{String}` : sMsg
  Log message.

This event is defined by Logger.

### sourceCreateEvent

`public event sourceCreateEvent`
Fired when a new source has been named.
Subscribers will be called with the following parameters:

- `{String}` : sSource
  Source name.

This event is defined by Logger.

yui-ext - Copyright © 2006 Jack Slocum. | Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.