# Yahoo! UI Library

### Logger Widget

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

## Class YAHOO.widget.LogReader

The LogReader class provides UI to read messages logged to YAHOO.widget.Logger.

### Constructor

YAHOO.widget.LogReader `( elContainer , oConfigs )`

Parameters:
  `elContainer <HTMLElement>` (optional) DOM element reference of an existing DIV.
  `elContainer <String>` (optional) String ID of an existing DIV.
  `oConfigs <Object>` (optional) Object literal of configuration params.

### Properties

#### _btnClear `- private HTMLElement`

Clear button element.

#### _btnCollapse `- private HTMLElement`

Log reader collapse button element.

#### _btnPause `- private HTMLElement`

Log reader pause button element.

#### _buffer `- private Object[]`

Buffer of log message objects for batch output.

#### _categoryFilters `- private String[]`

Array of filters for log message categories.

#### _consoleMsgCount `- private Number`

Number of log messages output to console.
Default Value: 0

#### _elBtns `- private HTMLElement`

Log reader buttons container element.

#### _elCategoryFilters `- private HTMLElement`

Container element for log reader category filter checkboxes.

#### _elCollapse `- private HTMLElement`

Log reader collapse element.

#### _elConsole `- private HTMLElement`

Log reader console element.

#### _elContainer `- private HTMLElement`

Log reader container element.

#### _elDefaultContainer `- private HTMLElement`

A class member shared by all log readers if a container needs to be created during instantiation. Will be null if a container element never needs to be created on the fly, such as when the implementer passes in their own element.

#### _elFt `- private HTMLElement`

Log reader footer element.

#### _elHd `- private HTMLElement`

Log reader header element.

#### _elSourceFilters `- private HTMLElement`

Container element for log reader source filter checkboxes.

#### _lastTime `- private Date`

Date of last output log message.

#### _memberName `- private static Number`

Internal class member to index multiple log reader instances.
Default Value: 0

#### _sName `- private String`

Name of LogReader instance.

#### _sourceFilters `- private String[]`

Array of filters for log message sources.

#### _timeout `- private Number`

Batched output timeout ID.

#### _title `- private HTMLElement`

Log reader title header element.

#### bottom `- String`

Public member to access CSS bottom position of the log reader container.

#### fontSize `- String`

Public member to access CSS font size of the log reader container.

#### footerEnabled `- Boolean`

Whether or not the footer UI is enabled for the log reader.
Default Value: true

#### height `- String`

Public member to access CSS height of the log reader container.

#### left `- String`

Public member to access CSS left position of the log reader container.

#### logReaderEnabled `- Boolean`

Whether or not the log reader is enabled to output log messages.
Default Value: true

#### newestOnTop `- Boolean`

Whether or not newest message is printed on top.

#### right `- String`

Public member to access CSS right position of the log reader container.

#### thresholdMax `- Number`

Maximum number of messages a LogReader console will display.
Default Value: 500

#### thresholdMin `- Number`

When a LogReader console reaches its thresholdMax, it will clear out messages and print out the latest thresholdMin number of messages.
Default Value: 100

#### top `- String`

Public member to access CSS top position of the log reader container.

#### verboseOutput `- Boolean`

Whether or not output is verbose (more readable). Setting to true will make output more compact (less readable).
Default Value: true

#### width `- String`

Public member to access CSS width of the log reader container.

### Methods

#### _clearConsole

`private void _clearConsole ( )`
Clears all outputted log messages from the console and resets the time of the last output log message.

Returns: `void`

#### _createCategoryCheckbox

`private void _createCategoryCheckbox ( sCategory )`
Creates the UI for a category filter in the log reader footer element.

Parameters:
  `sCategory <String>` Category name.

Returns: `void`

#### _createSourceCheckbox

`private void _createSourceCheckbox ( sSource )`
Creates a checkbox in the log reader footer element to filter by source.

Parameters:
  `sSource <String>` Source name.

Returns: `void`

#### _filterLogs

`private void _filterLogs ( )`
Reprints all log messages in the stack through filters.

Returns: `void`

#### _onCategoryCreate

`private void _onCategoryCreate ( sType , aArgs , oSelf )`
Handles Logger's categoryCreateEvent.

Parameters:
  `sType <String>` The event.
  `aArgs <Object[]>` Data passed from event firer.
  `oSelf <Object>` The LogReader instance.

Returns: `void`

#### _onCheckCategory

`private void _onCheckCategory ( v , oSelf )`
Handles check events on the category filter checkboxes.

Parameters:
  `v <HTMLEvent>` The click event.
  `oSelf <Object>` The LogReader instance.

Returns: `void`

#### _onCheckSource

`private void _onCheckSource ( v , oSelf )`
Handles check events on the category filter checkboxes.

Parameters:
  `v <HTMLEvent>` The click event.
  `oSelf <Object>` The log reader instance.

Returns: `void`

#### _onClickClearBtn

`private void _onClickClearBtn ( v , oSelf )`
Handles click events on the clear button.

Parameters:
  `v <HTMLEvent>` The click event.
  `oSelf <Object>` The LogReader instance.

Returns: `void`

#### _onClickCollapseBtn

`private void _onClickCollapseBtn ( v , oSelf )`
Handles click events on the collapse button.

Parameters:
  `v <HTMLEvent>` The click event.
  `oSelf <Object>` The LogReader instance

Returns: `void`

#### _onClickPauseBtn

`private void _onClickPauseBtn ( v , oSelf )`
Handles click events on the pause button.

Parameters:
  `v <HTMLEvent>` The click event.
  `oSelf <Object>` The LogReader instance.

Returns: `void`

#### _onNewLog

`private void _onNewLog ( sType , aArgs , oSelf )`
Handles Logger's newLogEvent.

Parameters:
  `sType <String>` The event.
  `aArgs <Object[]>` Data passed from event firer.
  `oSelf <Object>` The LogReader instance.

Returns: `void`

#### _onReset

`private void _onReset ( sType , aArgs , oSelf )`
Handles Logger's resetEvent.

Parameters:
  `sType <String>` The event.
  `aArgs <Object[]>` Data passed from event firer.
  `oSelf <Object>` The LogReader instance.

Returns: `void`

#### _onSourceCreate

`private void _onSourceCreate ( sType , aArgs , oSelf )`
Handles Logger's sourceCreateEvent.

Parameters:
  `sType <String>` The event.
  `aArgs <Object[]>` Data passed from event firer.
  `oSelf <Object>` The LogReader instance.

Returns: `void`

#### _printBuffer

`private void _printBuffer ( )`
Sends buffer of log messages to output and clears buffer.

Returns: `void`

#### _printToConsole

`private void _printToConsole ( aEntries )`
Cycles through an array of log messages, and outputs each one to the console if its category has not been filtered out.

Parameters:
  `aEntries <Object[]>` Array of LogMsg objects to output to console.

Returns: `void`

#### formatMsg

`String formatMsg ( oLogMsg )`
Formats message string to HTML for output to console.

Parameters:
  `oLogMsg <Object>` Log message object.

Returns: `String`
  HTML-formatted message for output to console.

#### getLastTime

`Date getLastTime ( )`
Gets timestamp of the last log.

Returns: `Date`
  Timestamp of the last log.

#### hide

`void hide ( )`
Hides UI of log reader. Logging functionality is not disrupted.

Returns: `void`

#### html2Text

`private void html2Text ( sHtml )`
Converts input chars "<", ">", and "&" to HTML entities.

Parameters:
  `sHtml <String>` String to convert.

Returns: `void`

#### pause

`void pause ( )`
Pauses output of log messages. While paused, log messages are not lost, but get saved to a buffer and then output upon resume of log reader.

Returns: `void`

#### resume

`void resume ( )`
Resumes output of log messages, including outputting any log messages that have been saved to buffer while paused.

Returns: `void`

#### setTitle

`void setTitle ( sTitle )`
Updates title to given string.

Parameters:
  `sTitle <String>` New title.

Returns: `void`

#### show

`void show ( )`
Shows UI of log reader. Logging functionality is not disrupted.

Returns: `void`

#### toString

`String toString ( )`
Public accessor to the unique name of the LogReader instance.

Returns: `String`
  Unique name of the LogReader instance.

Copyright © 2006 Yahoo! Inc. All rights reserved.