NativeScript Core

Console

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.

iOS Specifics: On iOS the logging is enabled only in debug and will not work in release.

Usage

Common log operations through the console.

console.log("NativeScript Playground!");
console.log({ objProp: "I am Object!" });
console.info("NativeScript Rocks!");
console.warn("Low memory");
console.error("Uncaught Application Exception");
console.dir(jsonObj);
console.log("NativeScript Playground!");
console.log({ objProp: "I am Object!" });
console.info("NativeScript Rocks!");
console.warn("Low memory");
console.error("Uncaught Application Exception");
console.dir(jsonObj);

Measuring time intervals with time and timeEnd methods.

// Begins counting a time span for a given name (key).
console.time("LoadTime");
// Ends a previously started time span through the time method.
console.timeEnd("LoadTime");
// Begins counting a time span for a given name (key).
console.time("LoadTime");
// Ends a previously started time span through the time method.
console.timeEnd("LoadTime");

Printing the stack trace through the trace method.

Improve this document

Demo Source