-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add withModifiedContext to StructuredLogger #361
Add withModifiedContext to StructuredLogger #361
Conversation
I'm just trying to do releases. Paging the experts who use this library more extensively before I merge. |
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.
I like this addition to the library 👍
I would like to see the same method added to org.typelevel.log4cats.SelfAwareStructuredLogger
as well to maintain predictability in usage.
def info(message: => String): F[Unit] = sl.info(outer)(message) | ||
def debug(message: => String): F[Unit] = sl.debug(outer)(message) | ||
def trace(message: => String): F[Unit] = sl.trace(outer)(message) | ||
private def whenEmpty: Map[String, String] = modify(Map.empty) |
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.
This can be easily turned back into a val
, right? Since applying a pure function to the same value, yields the same result.
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.
@lorandszakacs thanks! I've replaced with lazy val
core/shared/src/main/scala/io/chrisdavenport/log4cats/StructuredLogger.scala
Outdated
Show resolved
Hide resolved
Added similar method to |
8160e19
to
510b1a2
Compare
510b1a2
to
7e16488
Compare
7e16488
to
35ef8b9
Compare
LGTM 👍 @ChristopherDavenport, do you want to review this? |
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'll need to not forget to merge this forward to main before releasing that.
Add ability to modify context, similar to
Logger.withModifiedString
Example: mask some sensitive structure field values