Skip to content

Commit

Permalink
added more details to logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Espinola committed Jun 26, 2024
1 parent f9e7f04 commit 53be50d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Sources/API/ATTNAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ extension ATTNAPI {
let request = URLRequest(url: url)
let task = urlSession.dataTask(with: request) { [weak self] data, response, error in
if let error = error {
Loggers.network.error("Error getting the geo-adjusted domain. Error: '\(error.localizedDescription)'")
Loggers.network.error("Error getting the geo-adjusted domain for \(domain). Error: '\(error.localizedDescription)'")
completionHandler(nil, error)
return
}
Expand All @@ -199,7 +199,7 @@ extension ATTNAPI {
}

guard httpResponse.statusCode == 200, let data = data else {
Loggers.network.error("Error getting the geo-adjusted domain. Incorrect status code: '\(httpResponse.statusCode)'")
Loggers.network.error("Error getting the geo-adjusted domain for \(domain). Incorrect status code: '\(httpResponse.statusCode)'")
completionHandler(nil, NSError(domain: "com.attentive.API", code: NSURLErrorBadServerResponse, userInfo: nil))
return
}
Expand Down
7 changes: 6 additions & 1 deletion Sources/Public/SDK/ATTNSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ public final class ATTNSDK: NSObject {
@objc public var skipFatigueOnCreative: Bool = false

public init(domain: String, mode: ATTNSDKMode) {
Loggers.creative.trace("Init ATTNSDKFramework v\(ATTNConstants.sdkVersion). Mode: \(mode.rawValue)")
Loggers.creative.trace("Init ATTNSDKFramework v\(ATTNConstants.sdkVersion), Mode: \(mode.rawValue), Domain: \(domain)")

self.domain = domain
self.mode = mode

Expand Down Expand Up @@ -84,6 +85,7 @@ public final class ATTNSDK: NSObject {
public func identify(_ userIdentifiers: [String: Any]) {
userIdentity.mergeIdentifiers(userIdentifiers)
api.send(userIdentity: userIdentity)
Loggers.event.debug("Send User Identifiers: \(userIdentifiers)")
}

@objc(trigger:)
Expand All @@ -109,14 +111,17 @@ public final class ATTNSDK: NSObject {
@objc(clearUser)
public func clearUser() {
userIdentity.clearUser()
Loggers.creative.debug("Clear user. New visitor id: \(self.userIdentity.visitorId, privacy: .public)")
}

@objc(updateDomain:)
public func update(domain: String) {
guard self.domain != domain else { return }
self.domain = domain
api.update(domain: domain)
Loggers.creative.trace("Updated SDK with new domain: \(domain)")
api.send(userIdentity: userIdentity)
Loggers.creative.trace("Retrigger Identity Event with new domain '\(domain)'")
}
}

Expand Down

0 comments on commit 53be50d

Please sign in to comment.