Javascript logging: Difference between revisions
From wikinotes
(Created page with "Logging in javascript is exposed through <code>console</code>. <syntaxhighlight lang="javascript"> console.error("error"); console.warn("warning"); console.log("info"); console.debug("debug"); </syntaxhighlight>") |
No edit summary |
||
Line 1: | Line 1: | ||
Logging in javascript is exposed through <code>console</code>. | Logging in javascript is exposed through <code>console</code>. | ||
= Log Levels = | |||
<blockquote> | |||
You can change the emitted message's log level | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
console.error("error"); | console.error("error"); | ||
Line 7: | Line 10: | ||
console.debug("debug"); | console.debug("debug"); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
The log level itself appears to be controlled by the browser's UI. | |||
</blockquote><!-- Log Levels --> |
Latest revision as of 21:39, 18 December 2022
Logging in javascript is exposed through console
.
Log Levels
You can change the emitted message's log level
console.error("error"); console.warn("warning"); console.log("info"); console.debug("debug");The log level itself appears to be controlled by the browser's UI.