Skip to content

Customizable console.group indentation #32947

Closed
@privatenumber

Description

@privatenumber

Is your feature request related to a problem? Please describe.
The indentation width used by console.group is too small for me.

Describe the solution you'd like
Customizable indentation width. Perhaps with a Node flag or env variable as we probably won't want to modify the console.group API.


As a hacky workaround, I'm currently overwriting console.group:

const kGroupIndent = Object.getOwnPropertySymbols(console).find(s => s.description === 'kGroupIndent');
const 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);
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    consoleIssues and PRs related to the console subsystem.feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions