Chapter 16

Working With the Console

Examples

Recipe 16.1
Styling Console Output

Use CSS to style the console output.

Recipe 16.2
Using Log Levels

Use the different log levels supported by the Console API.

Recipe 16.3
Creating Named Loggers

Create logger objects with a specified prefix and color.

Recipe 16.4
Displaying Data in a Table

Log an array of objects in table form.

Recipe 16.4
Using Console Timers

Use timers to calculate how long an operation takes, and log the result.

Recipe 16.5
Using Console Groups

Created nested groups of log messages.

Recipe 16.6
Using Counters

Count the number of times a block of code is executed.

Recipe 16.7
Logging a Variable and Its Value

Use object shorthand notation to quickly log a variable and its value.

Recipe 16.8
Logging a Stack Trace

Print the current call stack.

Recipe 16.9
Validating Expected Values

Throw an error if an expression does not have the expected value.

Recipe 16.10
Examining an Object's Properties

Show an expandable tree structure of an object's properties.

Web API Cookbook
Joe Attardi