Skip to content

Commit

Permalink
Warning logs for unknown SR privacy levels
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-saia-datadog committed Nov 19, 2024
1 parent 5fb15a2 commit 5a2e59e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

package com.datadog.reactnative.sessionreplay

import android.util.Log
import com.datadog.android.sessionreplay.ImagePrivacy
import com.datadog.android.sessionreplay.TextAndInputPrivacy
import com.datadog.android.sessionreplay.TouchPrivacy
Expand Down Expand Up @@ -45,7 +46,11 @@ class SessionReplayPrivacySettings(
"MASK_ALL" -> ImagePrivacy.MASK_ALL
"MASK_NONE" -> ImagePrivacy.MASK_NONE
else -> {
// TODO: Log wrong usage / mapping.
Log.w(
SessionReplayPrivacySettings::class.java.canonicalName,
"Unknown Session Replay Image Privacy Level given: $imagePrivacyLevel, " +
"using ${ImagePrivacy.MASK_ALL} as default"
)
ImagePrivacy.MASK_ALL
}
}
Expand All @@ -56,7 +61,11 @@ class SessionReplayPrivacySettings(
"SHOW" -> TouchPrivacy.SHOW
"HIDE" -> TouchPrivacy.HIDE
else -> {
// TODO: Log wrong usage / mapping.
Log.w(
SessionReplayPrivacySettings::class.java.canonicalName,
"Unknown Session Replay Touch Privacy Level given: $touchPrivacyLevel, " +
"using ${TouchPrivacy.HIDE} as default"
)
TouchPrivacy.HIDE
}
}
Expand All @@ -68,10 +77,14 @@ class SessionReplayPrivacySettings(
"MASK_ALL_INPUTS" -> TextAndInputPrivacy.MASK_ALL_INPUTS
"MASK_ALL" -> TextAndInputPrivacy.MASK_ALL
else -> {
// TODO: Log wrong usage / mapping
Log.w(
SessionReplayPrivacySettings::class.java.canonicalName,
"Unknown Session Replay Text And Input Privacy Level given: $textAndInputPrivacyLevel, " +
"using ${TextAndInputPrivacy.MASK_ALL} as default"
)
TextAndInputPrivacy.MASK_ALL
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public class DdSessionReplayImplementation: NSObject {
case "MASK_NONE":
return .maskNone
default:
// TODO: Log wrong usage / mapping
consolePrint("Unknown Session Replay Image Privacy Level given: \(imagePrivacy), using .maskAll as default.", .warn)
return .maskAll
}
}
Expand All @@ -110,7 +110,7 @@ public class DdSessionReplayImplementation: NSObject {
case "HIDE":
return .hide
default:
// TODO: Log wrong usage / mapping
consolePrint("Unknown Session Replay Touch Privacy Level given: \(touchPrivacy), using .hide as default.", .warn)
return .hide
}
}
Expand All @@ -124,7 +124,7 @@ public class DdSessionReplayImplementation: NSObject {
case "MASK_ALL":
return .maskAll
default:
// TODO: Log wrong usage / mapping
consolePrint("Unknown Session Replay Text and Input Privacy Level given: \(textAndInputPrivacy), using .maskAll as default.", .warn)
return .maskAll
}
}
Expand Down

0 comments on commit 5a2e59e

Please sign in to comment.