-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove dependency on logback-classic and scala-logging where unnecessary #3471
Remove dependency on logback-classic and scala-logging where unnecessary #3471
Conversation
a1a4895
to
a5cc585
Compare
a5cc585
to
4b4f1c9
Compare
...ect/src/main/scala/sttp/tapir/serverless/aws/lambda/runtime/AwsLambdaRuntimeInvocation.scala
Outdated
Show resolved
Hide resolved
project/Versions.scala
Outdated
@@ -7,7 +7,7 @@ object Versions { | |||
val circe = "0.14.6" | |||
val circeGenericExtras = "0.14.3" | |||
val circeYaml = "0.15.1" | |||
val helidon = "4.0.0" | |||
val helidon = "4.0.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: Could we keep this change for another PR?
|
||
val renderer: ProtoRenderer = new ProtoRenderer() | ||
val interpreter = new ProtobufInterpreter(new EndpointToProtobufMessage(), new EndpointToProtobufService()) | ||
val proto = interpreter.toProtobuf(endpoints, Some(packageName)) | ||
|
||
val renderedProto = renderer.render(proto) | ||
|
||
logger.debug(s"Generated protobuf structure: [$renderedProto]") | ||
logger.info(s"Writing proto file to the path [$path]") | ||
logger.debug("Generated protobuf structure: [{}]", renderedProto) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: To take advantage of slf4sj's deferred evaluation when formatting, this should be
logger.debug("Generated protobuf structure: [{}]", renderer.render(proto))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're using slf4j, not slf4s, so if at all, this would have to be a lambda to be lazily evaluated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, this has to be a lambda. slf4j has API for that, I think only in the 2.0's fluent API https://www.slf4j.org/manual.html#fluent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In any case renderedProto
is called again on line 28, so I don't think it matters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I didn't notice that. Maybe we can keep the standard string interpolation then?
server/netty-server/zio/src/main/scala/sttp/tapir/server/netty/zio/NettyZioServerOptions.scala
Show resolved
Hide resolved
noLog = () | ||
) | ||
|
||
private def debugLog(msg: String, exOpt: Option[Throwable]): Unit = exOpt match { | ||
case Some(e) => log.log(Level.FINE, msg, e) | ||
case None => log.log(Level.FINE, msg) | ||
case Some(e) => log.debug(msg, e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Shouldn't this method check logger.isDebugEnabled()
as well?
@@ -82,10 +85,11 @@ object AwsLambdaRuntimeInvocation extends StrictLogging { | |||
val sendResult: (RequestEvent, Either[Throwable, AwsResponse]) => F[Unit] = (event, result) => | |||
result match { | |||
case Right(response) => | |||
logger.info(s"Request event ${event.requestId} completed successfully") | |||
logger.info("Request event {} completed successfully", event.requestId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: While the slf4j's formatter's deferred evaluation can help to avoid evaluating expensive expressions, I don't think it should be used in all cases. Here we have a simple expression (event.requestId
) and INFO
level, so it will always be evaluated anyway. Using interpolated string where possible makes the message much more readable in the code IMO. (This comment applies to other usages where I don't see a clear gain, like logger.error
calls above and below).
Thanks a lot @hygt! |
Thanks! :) |
Fixes #3464