mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 22:01:42 +08:00
36 lines
966 B
Markdown
36 lines
966 B
Markdown
---
|
|
nav-title: "console How-To"
|
|
title: "console"
|
|
environment: nativescript
|
|
description: "Examples for using console"
|
|
previous_url: /ApiReference/console/HOW-TO
|
|
---
|
|
# Console
|
|
### Logging
|
|
Logging to the console does not require the "console" module since the console variable is global. It can be used anywhere within your code.
|
|
You can log your message in several different categories.
|
|
{%snippet console-log%}
|
|
|
|
### Time
|
|
Begins counting a time span for a given name (key).
|
|
{%snippet console-time%}
|
|
|
|
Ends a previously started time span through the time method.
|
|
{%snippet console-timeend%}
|
|
|
|
### Assert
|
|
Asserts a boolean condition and prints a message in case the assert fails.
|
|
{%snippet console-assert%}
|
|
|
|
### Dir
|
|
Prints the state of the specified object to the console.
|
|
{%snippet console-dir%}
|
|
|
|
### Dump
|
|
Prints the state of the specified object to the console.
|
|
{%snippet console-dump%}
|
|
|
|
### Trace
|
|
Prints the current stack trace in the console.
|
|
{%snippet console-trace%}
|