Skip to content

adriancmiranda/trace

Repository files navigation

trace

Displays expressions, or writes to log files, while debugging. A single trace statement can support multiple arguments. If any argument in a trace statement includes a data type other than a String, the trace function invokes the associated toString() method for that data type. For example, if the argument is a Boolean value the trace function invokes Boolean.toString() and displays the return value.

deps depsci travis appveyor circleci codacy

How to install trace in your project

bower

bower install --save-dev adriancmiranda/trace

cdn

uncompressed

<script src="https://rawgit.com/adriancmiranda/trace/master/index.js"></script>

compressed

<script src="https://rawgit.com/adriancmiranda/trace/master/index.min.js"></script>

Usage

Join debug query in URL (e.g. <url>?debug=*) or set console.enabled = true; in your JavaScript code to show your logs and then use the console normally.

P.S. you can also usage the trace method as an alias to console.log (:zap: flash feelings :sunglasses:)

⚫️ trace(...arguments):void

parameters

... arguments — One or more (comma separated) expressions to evaluate. For multiple expressions, a space is inserted between each expression in the output.

example

The following example uses the trace() method to print a simple string. Generally, the message will be printed to a Developer Tools > Console.

trace("Hello", "World");

⚫️ console.enabled:boolean

A Boolean value that indicates whether the console is enabled.

⚫️ console.history:array

[read-only] Contents of the history stack

⚫️ console.scrollback:uint

The number of lines of scrollback buffer to keep above the visible part of the screen.

⚫️ console.push(...arguments):void

parameters

... arguments — One or more (comma separated) expressions to evaluate. For multiple expressions, a space is inserted between each expression in the output.

⚫️ console.flush():void

To clear the appended log with console.push method

License

MIT

About

Displays expressions, or writes to log files, while debugging.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors