The goog.debug Namespace

The goog.debug.Console Class

Create and install a log handler that logs to window.console if available … more

The goog.debug.DebugWindow Class

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. … more

The goog.debug.DevCss Class

A class for solving development CSS issues/emulating the CSS Compiler. … more

The goog.debug.DivConsole Class

A class for visualising logger calls in a div element. … more

The goog.debug.EntryPointMonitor Interface

… more

The goog.debug.Error Class

Base class for custom error objects. … more

The goog.debug.ErrorHandler Class

The ErrorHandler can be used to to wrap functions with a try/catch statement. If an exception is thrown, the given error handler function will be called. When this object is disposed, it will stop handling exceptions and tracing. It will also try to restore window.setTimeout and window.setInterval if it wrapped them. Notice that in the general case, it is not technically possible to remove the wrapper, because functions have no knowledge of what they have been assigned to. So the app is responsible for other forms of unwrapping. … more

The goog.debug.ErrorReporter Class

Constructs an error reporter. Internal Use Only. To install an error reporter see the {@see #install} method below. … more

The goog.debug.FancyWindow Class

Provides a Fancy extension to the DebugWindow class. Allows filtering based on loggers and levels. … more

The goog.debug.Formatter Class

Base class for Formatters. A Formatter is used to format a LogRecord into something that can be displayed to the user. … more

The goog.debug.FpsDisplay Class

Displays frames per seconds that the window this component is rendered in is animating at. … more

.GcDiagnostics {goog.debug.GcDiagnostics_}

Singleton GcDiagnostics object

The goog.debug.HtmlFormatter Class

Formatter that returns formatted html. See formatRecord for the classes it uses for various types of formatted output. … more

The goog.debug.LogBuffer Class

Creates the log buffer. … more

The goog.debug.LogManager Namespace

There is a single global LogManager object that is used to maintain a set of shared state about Loggers and log services. This is loosely based on the java class java.util.logging.LogManager. … more

The goog.debug.LogRecord Class

LogRecord objects are used to pass logging requests between the logging framework and individual log Handlers. … more

The goog.debug.Logger Class

The Logger is an object used for logging debug messages. Loggers are normally named, using a hierarchical dot-separated namespace. Logger names can be arbitrary strings, but they should normally be based on the package name or class name of the logged component, such as goog.net.BrowserChannel. The Logger object is loosely based on the java class java.util.logging.Logger. It supports different levels of filtering for different loggers. The logger object should never be instantiated by application code. It should always use the goog.debug.Logger.getLogger function. … more

.MAX_STACK_DEPTH {number}

Max length of stack to try and output

The goog.debug.RelativeTimeProvider Class

A simple object to keep track of a timestamp considered the start of something. The main use is for the logger system to maintain a start time that is occasionally reset. For example, in Gmail, we reset this relative time at the start of a user action so that timings are offset from the beginning of the action. This class also provides a singleton as the default behavior for most use cases is to share the same start time. … more

The goog.debug.TextFormatter Class

Formatter that returns formatted plain text … more

.Trace {goog.debug.Trace_}

Singleton trace object

.catchErrors(logFunc, opt_cancel, opt_target)

Catches onerror events fired by windows and similar objects.

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.

.deepExpose(obj, opt_showFn)

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.

obj {*}
Object to expose.
opt_showFn {boolean=}
Also show properties that are functions (by default, functions are omitted).
returns {string}
A string representation of {@code obj}.

.devCssRunner

.enhanceError(err, opt_message)

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.

err {Error|string}
the original thrown object or string.
opt_message {string=}
optional additional message to add to the error.
returns {Error}
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.

The goog.debug.entryPointRegistry Namespace

… more

.errorHandlerWeakDep {Object}

Dummy object to work around undefined properties compiler warning.

.expose(obj, opt_showFn)

Creates a string representing an object and all its properties.

obj {Object|null|undefined}
Object to expose.
opt_showFn {boolean=}
Show the functions as well as the properties, default is false.
returns {string}
The string representation of {@code obj}.

.exposeArray(arr)

Recursively outputs a nested array as a string.

arr {Array}
The array.
returns {string}
String representing nested array.

.exposeException(err, opt_fn)

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

err {Object}
Error object or string.
opt_fn {Function=}
Optional function to start stack trace from.
returns {string}
Details of exception.

.getFunctionName(fn)

Gets a function name

fn {Function}
Function to get name of.
returns {string}
Function's name.

.getStacktrace(opt_fn)

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

opt_fn {Function=}
Optional function to start getting the trace from. If not provided, defaults to the function that called this.
returns {string}
Stack trace.

.getStacktraceSimple(opt_depth)

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

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

The goog.debug.logRecordSerializer Namespace

… more

.makeWhitespaceVisible(string)

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.

string {string}
whose whitespace needs to be made visible.
returns {string}
string whose whitespace is made visible.

.normalizeErrorObject(err)

Normalizes the error/exception object between browsers.

err {Object}
Raw error object.
returns {Object}
Normalized error object.

The goog.debug.reflect Namespace

… more

.setFunctionResolver(resolver)

Set a custom function name resolver.

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