I/O
Interfaces for reading, writing, seeking, and managing resources. For handling of data streams, file I/O, and console interactions.
Eg stdin, inspect
interface Console
The Console interface provides methods for logging information to the console, as well as other utility methods for debugging and inspecting code. Methods include logging, debugging, and timing functionality.
Methods
assert(
condition?: boolean,
...data: any[],
): void Tests that an expression is true. If not, logs an error message
clear(): void Clears the console if the environment allows it
count(label?: string): void Maintains an internal counter for a given label, incrementing it each time the method is called
countReset(label?: string): void Resets the counter for a given label
debug(...data: any[]): void Outputs a debugging message to the console
dir(
item?: any,
options?: any,
): void Displays a list of the properties of a specified object
error(...data: any[]): void Outputs an error message to the console. This method routes the output to stderr, unlike other console methods that route to stdout.
group(...data: any[]): void Creates a new inline group in the console, indenting subsequent console messages
groupCollapsed(...data: any[]): void Creates a new inline group in the console that is initially collapsed
groupEnd(): void Exits the current inline group in the console
info(...data: any[]): void Outputs an informational message to the console
log(...data: any[]): void Outputs a message to the console
table(
tabularData?: any,
properties?: string[],
): void Displays tabular data as a table
time(label?: string): void Starts a timer you can use to track how long an operation takes
timeEnd(label?: string): void Stops a timer that was previously started
timeLog(
label?: string,
...data: any[],
): void Logs the current value of a timer that was previously started
trace(...data: any[]): void Outputs a stack trace to the console
warn(...data: any[]): void Outputs a warning message to the console
timeStamp(label?: string): void Adds a marker to the DevTools Performance panel
profile(label?: string): void Starts recording a performance profile
profileEnd(label?: string): void Stops recording a performance profile
See
variable console
A global console object that provides methods for logging, debugging, and error reporting. The console object provides access to the browser's or runtime's debugging console functionality. It allows developers to output text and data for debugging purposes.
Examples
console.log("Hello, world!");
console.error("An error occurred");
console.warn("Warning message");
console.debug("Debug information");
Type
See
© 2018–2025 the Deno authors
Licensed under the MIT License.
https://docs.deno.com/api/web/io