Tuesday, 2 October 2018

node.js: console.groupCollapsed(): Log the messages with indentation

console.groupCollapsed()
It is an alias for console.group(), logs the message and increases indentation of subsequent lines by two spaces.

HelloWorld.js
console.groupCollapsed("User '%s' login failed", "Krishna");
console.groupCollapsed("Please retry after some time");
console.groupCollapsed("If you forgot the password, please retry");

Output
User 'Krishna' login failed
  Please retry after some time
    If you forgot the password, please retry

Previous                                                 Next                                                 Home

No comments:

Post a Comment