debug

Classes

goog.debug.Console
Create and install a log handler that logs to window.console if available
goog.debug.DebugWindow
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.
goog.debug.DevCss
A class for solving development CSS issues/emulating the CSS Compiler.
goog.debug.DivConsole
A class for visualising logger calls in a div element.
goog.debug.Error
Base class for custom error objects.
goog.debug.ErrorHandler
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.
goog.debug.ErrorReporter
Constructs an error reporter. Internal Use Only. To install an error reporter see the method below.
goog.debug.FancyWindow
Provides a Fancy extension to the DebugWindow class. Allows filtering based on loggers and levels.
goog.debug.Formatter
Base class for Formatters. A Formatter is used to format a LogRecord into something that can be displayed to the user.
goog.debug.FpsDisplay
Displays frames per seconds that the window this component is rendered in is animating at.
goog.debug.GcDiagnostics_
Class used for singleton goog.debug.GcDiagnostics. Used to hook into the L2 ActiveX controller to profile garbage collection information in IE. Can be used in combination with tracers (goog.debug.Trace), to provide object allocation counts from within the tracers or used alone by invoking start and stop. See http://go/l2binary for the install. TODO(user): Move the L2 installer somewhere more general.
goog.debug.HtmlFormatter
Formatter that returns formatted html. See formatRecord for the classes it uses for various types of formatted output.
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. 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.
goog.debug.RelativeTimeProvider
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.
goog.debug.TextFormatter
Formatter that returns formatted plain text
goog.debug.Trace_
Class used for singleton goog.debug.Trace. Used for timing slow points in the code. Based on the java Tracer class but optimized for javascript. See com.google.common.tracing.Tracer.

Public Protected Private

Global Functions

goog.debug.catchErrors(logFuncopt_cancelopt_target)
Catches onerror events fired by windows and similar objects.
Arguments:
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(objopt_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.
Arguments:
obj : *
Object to expose.
opt_showFn : boolean=
Also show properties that are functions (by default, functions are omitted).
Returns: string  A string representation of obj.
code »
goog.debug.enhanceError(erropt_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.
Arguments:
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.
code »
goog.debug.expose(objopt_showFn) string
Creates a string representing an object and all its properties.
Arguments:
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 obj.
code »
goog.debug.exposeArray(arr) string
Recursively outputs a nested array as a string.
Arguments:
arr : Array
The array.
Returns: string  String representing nested array.
code »
goog.debug.exposeException(erropt_fn) string
Exposes an exception that has been caught by a try...catch and outputs the error with a stack trace.
Arguments:
err : Object
Error object or string.
opt_fn : Function=
Optional function to start stack trace from.
Returns: string  Details of exception.
code »
goog.debug.fnNameResolver_()
Resolves functions to their names. Resolved function names will be cached.
code »
goog.debug.getFunctionName(fn) string
Gets a function name
Arguments:
fn : Function
Function to get name of.
Returns: string  Function's name.
code »
goog.debug.getNativeStackTrace_(fn) ?string
No description.
Arguments:
fn : Function
The function to start getting the trace from.
Returns: ?string  No description.
code »
goog.debug.getStacktrace(opt_fn) string
Gets the current stack trace, either starting from the caller or starting from a specified function that's currently on the call stack.
Arguments:
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.
code »
goog.debug.getStacktraceHelper_(fnvisited) string
Private helper for getStacktrace().
Arguments:
fn : Function
Function to start getting the trace from.
visited : Array
List of functions visited so far.
Returns: string  Stack trace starting from function fn.
code »
goog.debug.getStacktraceSimple(opt_depth) string
Gets the current stack trace. Simple and iterative - doesn't worry about catching circular references or getting the args.
Arguments:
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.
code »
goog.debug.makeWhitespaceVisible(string) 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.
Arguments:
string : string
whose whitespace needs to be made visible.
Returns: string  string whose whitespace is made visible.
code »
goog.debug.normalizeErrorObject(err) !Object
Normalizes the error/exception object between browsers.
Arguments:
err : Object
Raw error object.
Returns: !Object  Normalized error object.
code »
goog.debug.setFunctionResolver(resolver)
Set a custom function name resolver.
Arguments:
resolver : function(Function): string
Resolves functions to their names.
code »

Global Properties

goog.debug.ConsoleTest :
No description.
Code »
goog.debug.DebugWindowTest :
No description.
Code »
goog.debug.DevCssTest :
No description.
Code »
goog.debug.ErrorHandlerAsyncTest :
No description.
Code »
goog.debug.ErrorHandlerTest :
No description.
Code »
goog.debug.ErrorReporterTest :
No description.
Code »
goog.debug.ErrorTest :
No description.
Code »
goog.debug.FpsDisplayTest :
No description.
Code »
goog.debug.GcDiagnostics : goog.debug.GcDiagnostics_
Singleton GcDiagnostics object
Code »
goog.debug.LOGGING_ENABLED :
No description.
Code »
goog.debug.LogBufferTest :
No description.
Code »
goog.debug.LogManager :
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.
Code »
goog.debug.Loggable :
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.
Code »
goog.debug.LoggerTest :
No description.
Code »
goog.debug.MAX_STACK_DEPTH :
Max length of stack to try and output
Code »
goog.debug.Trace : goog.debug.Trace_
Singleton trace object
Code »
goog.debug.TraceTest :
No description.
Code »
goog.debug.devCssRunner :
No description.
Code »
goog.debug.entryPointRegistry :
No description.
Code »
goog.debug.entryPointRegistryTest :
No description.
Code »
goog.debug.errorHandlerWeakDep :
Dummy object to work around undefined properties compiler warning.
Code »
goog.debug.fnNameCache_ :
Hash map for storing function names that have already been looked up.
Code »
goog.debug.logRecordSerializer :
No description.
Code »
goog.debug.logRecordSerializerTest :
No description.
Code »
goog.debug.reflect :
No description.
Code »
goog.debug.reflectTest :
No description.
Code »

Package debug

Package Reference