debug.DebugWindow Extends
Provides a debug DebugWindow that is bound to the goog.debug.Logger. It handles log messages and writes them to the DebugWindow. This doesn't provide a lot of functionality that the old Gmail logging infrastructure provided like saving debug logs for exporting to the server. Now that we have an event-based logging infrastructure, we can encapsulate that functionality in a separate class.

Inheritance

Constructor

goog.debug.DebugWindow(opt_identifieropt_prefix)

Parameters

opt_identifier : string=
Identifier for this logging class.
opt_prefix : string=
Prefix prepended to messages.

Instance Methods

Public Protected Private
addFilter(loggerName)
Adds a logger name to be filtered.
Arguments:
loggerName : string
the logger name to add.
code »
addLogRecord(logRecord)
Adds a log record.
Arguments:
logRecord : goog.debug.LogRecord
the LogRecord.
code »
addSeparator()
Adds a separator to the debug window.
code »
clear()
Clears the contents of the debug window
code »
getCookie_(keyopt_default) string
Retrieve data (using cookies).
Arguments:
key : string
Data name.
opt_default : string=
Optional default value if cookie doesn't exist.
Returns: string  Cookie value.
code »
getFormatter() goog.debug.Formatter
Gets the formatter for outputting to the debug window. The default formatter is an instance of goog.debug.HtmlFormatter
Returns: goog.debug.Formatter  The formatter in use.
code »
getStyleRules() string
No description.
Returns: string  The style rule text, for inclusion in the initial HTML.
code »
getWindowName_() string
Gets a valid window name for the debug window. Replaces invalid characters in IE.
Returns: string  Valid window name.
code »
hasActiveWindow() boolean
No description.
Returns: boolean  Whether there is an active window.
code »
init()
Initializes the debug window.
code »
isCapturing() boolean
Whether we are currently capturing logger output.
Returns: boolean  whether we are currently capturing logger output.
code »
isEnabled() boolean
Whether the DebugWindow is enabled. When the DebugWindow is enabled, it tries to keep its window open and logs all messages to the window. When the DebugWindow is disabled, it stops logging messages to its window.
Returns: boolean  Whether the DebugWindow is enabled.
code »
openWindow_()
Opens the debug window if it is not already referenced
code »
removeFilter(loggerName)
Removes a logger name to be filtered.
Arguments:
loggerName : string
the logger name to remove.
code »
resetBufferWithNewSize(size)
Modify the size of the circular buffer. Allows the log to retain more information while the window is closed.
Arguments:
size : number
New size of the circular buffer.
code »
saveWindowPositionSize_()
Saves the window position size to a cookie
code »
setCapturing(capturing)
Sets whether we are currently capturing logger output.
Arguments:
capturing : boolean
Whether to capture logger output.
code »
setCookie_(keyvalue)
Save persistent data (using cookies) for 1 month (cookie specific to this logger object).
Arguments:
key : string
Data name.
value : string
Data value.
code »
setEnabled(enable)
Sets whether the DebugWindow is enabled. When the DebugWindow is enabled, it tries to keep its window open and log all messages to the window. When the DebugWindow is disabled, it stops logging messages to its window. The DebugWindow also saves this state to a cookie so that it's persisted across application refreshes.
Arguments:
enable : boolean
Whether the DebugWindow is enabled.
code »
setForceEnableOnSevere(enableOnSevere)
Sets whether the debug window should be force enabled when a severe log is encountered.
Arguments:
enableOnSevere : boolean
Whether to enable on severe logs..
code »
setFormatter(formatter)
Sets the formatter for outputting to the debug window.
Arguments:
formatter : goog.debug.Formatter
The formatter to use.
code »
setWelcomeMessage(msg)
Sets the welcome message shown when the window is first opened or reset.
Arguments:
msg : string
An HTML string.
code »
writeBufferToLog()
Write to the log and maybe scroll into view.
code »
writeInitialDocument()
Writes the initial HTML of the debug window.
code »
writeSavedMessages()
Writes all saved messages to the DebugWindow.
code »
writeToLog_(html)
Write to the buffer. If a message hasn't been sent for more than 750ms just write, otherwise delay for a minimum of 250ms.
Arguments:
html : string
HTML to post to the log.
code »
write_(html)
Writes a message to the log, possibly opening up the window if it's enabled, or saving it if it's disabled.
Arguments:
html : string
The HTML to write.
code »

Instance Properties

bufferTimeout_ :
Reference to timeout used to buffer the output stream.
Code »
enableOnSevere_ :
Whether to force enable the window on a severe log.
Code »
enabled_ :
Whether we are currently enabled. When the DebugWindow is enabled, it tries to keep its window open. When it's disabled, it can still be capturing log output if, but it won't try to write them to the DebugWindow window until it's enabled.
Code »
filteredLoggers_ :
Loggers that we shouldn't output
Code »
Formatter for formatted output
Code »
identifier :
Identifier for this logging class
Code »
isCapturing_ :
Whether we are currently capturing logger output.
Code »
lastCall :
Timestamp for the last time the log was written to.
Code »
outputBuffer :
Array used to buffer log output
Code »
prefix_ :
Optional prefix to be prepended to error strings
Code »
publishHandler_ :
Save the publish handler so it can be removed
Code »
savedMessages_ : goog.structs.CircularBuffer
Buffer for saving the last 1000 messages
Code »
welcomeMessage :
HTML string printed when the debug window opens
Code »
win :
Reference to debug window
Code »
winOpening_ :
In the process of opening the window
Code »

Static Methods

goog.debug.DebugWindow.getCookieKey_(identifierkey) string
Creates a valid cookie key name which is scoped to the given identifier. Substitutes all occurences of invalid cookie name characters (whitespace, ';', and '=') with '_', which is a valid and readable alternative.
Arguments:
identifier : string
Identifier for logging class.
key : string
Data name.
Returns: string  Cookie key name.
code »
goog.debug.DebugWindow.getCookieValue_(identifierkeyopt_default) string
Retrieve data (using cookies).
Arguments:
identifier : string
Identifier for logging class.
key : string
Data name.
opt_default : string=
Optional default value if cookie doesn't exist.
Returns: string  Cookie value.
code »
goog.debug.DebugWindow.isEnabled(identifier) boolean
No description.
Arguments:
identifier : string
Identifier for logging class.
Returns: boolean  Whether the DebugWindow is enabled.
code »

Static Properties

goog.debug.DebugWindow.COOKIE_TIME :
How long to keep the cookies for in milliseconds
Code »
goog.debug.DebugWindow.MAX_SAVED :
Max number of messages to be saved
Code »
goog.debug.DebugWindow.showedBlockedAlert_ :
Whether we already showed an alert that the DebugWindow was blocked.
Code »

Package debug

Package Reference