pjfanning opened a new pull request, #1292:
URL: https://github.com/apache/pekko-http/pull/1292
### Motivation
Several main-source log calls built their message with `s"..."`
interpolation, so the message was rendered even when the log level was
disabled. A few of them also carried redundant `if (log.isXxxEnabled)` guards,
one used an `s` prefix on a string with no interpolation at all, and one
spliced a caller-supplied message into a template that also used `{}`
placeholders.
### Modification
- Convert eager `s"..."` log messages to `LoggingAdapter` `{}` templates
with the values passed as arguments, so the message is only rendered when the
level is enabled.
- Drop the now-redundant `isDebugEnabled` / `isErrorEnabled` guards in
`FrameOutHandler`, `Http2Blueprint` and `NewHostConnectionPool`.
- Remove the unnecessary `s` prefix from the `HttpsProxyGraphStage` message,
which had no interpolation.
- Pass the slot message in `NewHostConnectionPool.error` as a template
argument rather than splicing it into the template.
Rendered messages are unchanged.
### Result
No message string is built for a disabled log level, and a slot error
message containing `{}` can no longer be mistaken for a placeholder.
### Tests
- `sbt "http-core/compile" "http/compile"` - success
- `sbt "++3.3.8" "http-core/compile" "http/compile"` - success
- `sbt "http-core/testOnly
org.apache.pekko.http.impl.engine.server.HttpServerSpec
org.apache.pekko.http.impl.engine.ws.MessageSpec"` - 139 passed
- `sbt "http2-tests/testOnly
org.apache.pekko.http.impl.engine.http2.Http2ServerSpec
org.apache.pekko.http.impl.engine.http2.Http2ClientSpec"` - 174 passed
- `sbt "http-tests/testOnly
org.apache.pekko.http.scaladsl.unmarshalling.sse.EventStreamParserOversizedSpec"`
- 18 passed
- `sbt "http-core/scalafmt" "http/scalafmt"` - no changes
Existing `EventFilter` assertions in `HttpServerSpec`, `MessageSpec`,
`Http2ServerSpec`, `Http2ClientSpec` and `NewConnectionPoolSpec` pin the exact
rendered text of the changed messages, so they are the directional coverage for
this change.
### References
None - logging cleanup
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]