Skip to content

Commit

Permalink
Merge pull request #2399 from DataDog/jmoskovich/rum-7302/align-level…
Browse files Browse the repository at this point in the history
…s-sr-already-enabled

RUM-7302: Align log levels for sr already enabled
  • Loading branch information
jonathanmos authored Nov 18, 2024
2 parents 352d252 + 8a6a881 commit bd71625
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 bd71625

Please sign in to comment.