Namespace goog.debug

code »

Interfaces

Classes

goog.debug.Error
Base class for custom error objects.
goog.debug.LogBuffer
Creates the log buffer.
goog.debug.LogRecord
LogRecord objects are used to pass logging requests between the logging framework and individual log Handlers.
goog.debug.Logger
The Logger is an object used for logging debug messages.
Show:

Type Definitions

A message value that can be handled by a Logger. Functions are treated like callbacks, but are only called when the event's log level is enabled. This is useful for logging messages that are expensive to construct.

Global Functions

code »goog.debug.catchErrors ( logFunc, opt_cancel, opt_target )

Catches onerror events fired by windows and similar objects.

Parameters
logFunc: function(Object)
The function to call with the error information.
opt_cancel: boolean=
Whether to stop the error from reaching the browser.
opt_target: Object=
Object that fires onerror events.
code »goog.debug.deepExpose ( obj, opt_showFn )string

Creates a string representing a given primitive or object, and for an object, all its properties and nested objects. WARNING: If an object is given, it and all its nested objects will be modified. To detect reference cycles, this method identifies objects using goog.getUid() which mutates the object.

Parameters
obj: *
Object to expose.
opt_showFn: boolean=
Also show properties that are functions (by default, functions are omitted).
Returns
A string representation of obj.
code »goog.debug.enhanceError ( err, opt_message )!Error

Converts an object to an Error if it's a String, adds a stacktrace if there isn't one, and optionally adds an extra message.

Parameters
err: (Error|string)
the original thrown object or string.
opt_message: string=
optional additional message to add to the error.
Returns
If err is a string, it is used to create a new Error, which is enhanced and returned. Otherwise err itself is enhanced and returned.
code »goog.debug.expose ( obj, opt_showFn )string

Creates a string representing an object and all its properties.

Parameters
obj: (Object|null|undefined)
Object to expose.
opt_showFn: boolean=
Show the functions as well as the properties, default is false.
Returns
The string representation of obj.

Recursively outputs a nested array as a string.

Parameters
arr: Array
The array.
Returns
String representing nested array.

Exposes an exception that has been caught by a try...catch and outputs the error with a stack trace.

Parameters
err: Object
Error object or string.
opt_fn: Function=
Optional function to start stack trace from.
Returns
Details of exception.

Resolves functions to their names. Resolved function names will be cached.

Gets a function name

Parameters
fn: Function
Function to get name of.
Returns
Function's name.
Parameters
fn: Function
The function to start getting the trace from.

Gets the current stack trace, either starting from the caller or starting from a specified function that's currently on the call stack.

Parameters
opt_fn: Function=
Optional function to start getting the trace from. If not provided, defaults to the function that called this.
Returns
Stack trace.

Private helper for getStacktrace().

Parameters
fn: Function
Function to start getting the trace from.
visited: Array
List of functions visited so far.
Returns
Stack trace starting from function fn.

Gets the current stack trace. Simple and iterative - doesn't worry about catching circular references or getting the args.

Parameters
opt_depth: number=
Optional maximum depth to trace back to.
Returns
A string with the function names of all functions in the stack, separated by \n.

Makes whitespace visible by replacing it with printable characters. This is useful in finding diffrences between the expected and the actual output strings of a testcase.

Parameters
string: string
whose whitespace needs to be made visible.
Returns
string whose whitespace is made visible.

Normalizes the error/exception object between browsers.

Parameters
err: Object
Raw error object.
Returns
Normalized error object.

Set a custom function name resolver.

Parameters
resolver: function(Function): string
Resolves functions to their names.

Global Properties

Max length of stack to try and output

Hash map for storing function names that have already been looked up.

Compiler Constants