Skip to content

Commit

Permalink
RUM-7302: Align log levels for sr already enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmos committed Nov 18, 2024
1 parent ff6002f commit 8a6a881
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,17 @@ object SessionReplay {
private fun isAlreadyRegistered() =
currentRegisteredCore?.get()?.isCoreActive() == true

private fun logAlreadyRegisteredWarning(internalLogger: InternalLogger) =
private fun logAlreadyRegisteredWarning(internalLogger: InternalLogger) {
internalLogger.log(
level = InternalLogger.Level.WARN,
targets = listOf(InternalLogger.Target.MAINTAINER, InternalLogger.Target.TELEMETRY),
level = InternalLogger.Level.ERROR,
targets = listOf(InternalLogger.Target.MAINTAINER),
messageBuilder = { IS_ALREADY_REGISTERED_WARNING }
)

internalLogger.log(
level = InternalLogger.Level.DEBUG,
targets = listOf(InternalLogger.Target.TELEMETRY),
messageBuilder = { IS_ALREADY_REGISTERED_WARNING }
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,14 @@ internal class SessionReplayTest {

// Then
mockInternalLogger.verifyLog(
level = InternalLogger.Level.WARN,
targets = listOf(InternalLogger.Target.MAINTAINER, InternalLogger.Target.TELEMETRY),
level = InternalLogger.Level.ERROR,
targets = listOf(InternalLogger.Target.MAINTAINER),
message = IS_ALREADY_REGISTERED_WARNING
)

mockInternalLogger.verifyLog(
level = InternalLogger.Level.DEBUG,
targets = listOf(InternalLogger.Target.TELEMETRY),
message = IS_ALREADY_REGISTERED_WARNING
)
assertThat(SessionReplay.currentRegisteredCore?.get()).isEqualTo(mockCore1)
Expand Down

0 comments on commit 8a6a881

Please sign in to comment.