Skip to content

Commit

Permalink
Avoid logging an error for internal signal names
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Nov 4, 2024
1 parent 9fde196 commit 13d4da5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Sources/TelemetryDeck/Signals/SignalManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ final class SignalManager: SignalManageable, @unchecked Sendable {
].map { $0.lowercased() }
)

static let internalSignalNames: Set<String> = [
"TelemetryDeck.Error.occurred",
"TelemetryDeck.Navigation.pathChanged",
"TelemetryDeck.Purchase.completed",
"TelemetryDeck.Session.started",
]

private var signalCache: SignalCache<SignalPostBody>
let configuration: TelemetryManagerConfiguration

Expand Down Expand Up @@ -85,7 +92,7 @@ final class SignalManager: SignalManageable, @unchecked Sendable {
configuration: TelemetryManagerConfiguration
) {
// warn users about reserved keys to avoid unexpected behavior
if signalName.lowercased().hasPrefix("telemetrydeck.") {
if signalName.lowercased().hasPrefix("telemetrydeck."), !Self.internalSignalNames.contains(signalName) {
configuration.logHandler?.log(
.error,
message: "Sending signal with reserved prefix 'TelemetryDeck.' will cause unexpected behavior. Please use another prefix instead."
Expand Down

0 comments on commit 13d4da5

Please sign in to comment.