๐
Log
On this page
Console
console.time() and console.timeEnd()
Both these methods are used in conjunction with each other to know the amount of time
spent by a block or a function.
js
console.time("timer");console.timeEnd("timer");

js
console.table({ a: 1, b: 2, c: 3 });
console.count()
This method is used to count the number that the function hit by this counting method.
js
for (let i = 0; i < 3; i++) {console.count(i);}

console.table()
This method generates a table inside a console, for better readability. A table will be automatically generated for an array or an object.

console.group() and console.groupEnd()
These methods group() and groupEnd() allows us to group contents in a separate block, which will be indented.
js
console.group("group1");console.warn("warning");console.error("error");console.log("I belong to a group");console.groupEnd("group1");console.log("I dont belong to any group");

Loglevel
Minimal lightweight logging for JavaScript, adding reliable log level methods to wrap any available console.log methods
js
import * as loglevel from "loglevel";if (!__PROD__) {loglevel.setLevel("debug");} else {loglevel.setLevel("error");}export default loglevel;