-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
Closed
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.utilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.
Description
Is your feature request related to a problem? Please describe.
Many logger use util.format as the underlying implementation. e.g winston.logger.
So
logger.warn(1, 2, 3);
got result: 1 2 3
This is ok when log is simple, but for real world, space separated log is not easy to analysis.
I have to write like
logger.warn(v0 + '|' + v1 + '|' + v2);
or
logger.warn(``${v0}|${v1}|${v2}``); (how can i put single ` in github's code...)
Describe the solution you'd like
Consider add an env variable like process.env.NODE_FORMAT_SEPARATOR
code node/lib/internal/util/inspect.js line: 1541
while (a < args.length) {
const value = args[a];
str += join;
str += typeof value !== 'string' ? inspect(value, inspectOptions) : value;
join = ' ';
a++;
}
can be
const sepor = process.env.NODE_FORMAT_SEPARATOR || ' ';
while (a < args.length) {
const value = args[a];
str += join;
str += typeof value !== 'string' ? inspect(value, inspectOptions) : value;
join = sepor;
a++;
}
Describe alternatives you've considered
or just add a function to util to specify separator.
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.utilIssues and PRs related to the built-in util module.Issues and PRs related to the built-in util module.