Logger prints unformatted strings after ComponentLogger addition #2389
Labels
bug
Something isn't working
good first issue
Good for newcomers
up-for-grabs
Good for taking. Extra help will be provided by maintainers
Please answer these questions before submitting a bug report.
Versions
@opentelemetry/[email protected]
,@opentelemetry/[email protected]
node@14
Please provide the code you used to set up the OpenTelemetry SDK
HTTP example with log level set to
DEBUG
works.What did you do?
I'm running an example with HTTP instrumentation enabled. Logs show:
What did you expect to see?
Something like:
Additional context
console.log
only formats the first argument. Since ComponentLogger forces the first argument to now be the namespace it breaks all code that uses printf-like string formatting.To bring back the functionality to its previous state, we should util.format the args before passing them to
logProxy
inDiagComponentLogger
. However, that would force this behaviour on all the loggers, which I'd personally be cautious of. Unless any of the maintainers are strongly for it I'd just replace the usages of string formatting with template literals(`my log ${var}`
) instead, or useutil.format
before passing the arguments to the logger.Steps
The text was updated successfully, but these errors were encountered: