Skip to content

Instantly share code, notes, and snippets.

@privatenumber
Created April 24, 2020 04:52
Show Gist options
  • Save privatenumber/70f1777833e57da5184cf371cc53552b to your computer and use it in GitHub Desktop.
Save privatenumber/70f1777833e57da5184cf371cc53552b to your computer and use it in GitHub Desktop.
Increase console.group indentation
const kGroupIndent = Object.getOwnPropertySymbols(console).find(s => s.description === 'kGroupIndent');
function increaseConsoleGroupIndent(increaseIndentBy = ' ') {
const { group, groupEnd } = console;
console.group = function () {
group.apply(this, arguments);
this[kGroupIndent] += increaseIndentBy;
};
console.groupEnd = function () {
groupEnd.apply(this, arguments);
this[kGroupIndent] = this[kGroupIndent].slice(0, this[kGroupIndent].length - increaseIndentBy.length);
};
}
module.exports = increaseConsoleGroupIndent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment