-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathConnectButtonController+Logging.swift
44 lines (40 loc) · 1.34 KB
/
ConnectButtonController+Logging.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//
// ConnectButtonController+Logging.swift
// IFTTT SDK
//
// Copyright © 2020 IFTTT. All rights reserved.
//
import Foundation
extension ConnectButtonController {
static func log(handler: ((String) -> Void)?,
isEnabled: Bool,
event: String,
domain: String) {
guard isEnabled else { return }
if let handler = handler {
handler(event)
} else {
NSLog("[ConnectSDK/\(domain)] \(event)")
}
}
/// Logs localization events to the console only if `localizationLoggingEnabled` is `true`.
///
/// - Parameters:
/// - event: A string corresponding to the event to log.
static func localizationLog(_ event: String) {
log(handler: localizationLoggingHandler,
isEnabled: localizationLoggingEnabled,
event: event,
domain: "Localization")
}
/// Logs synchronization events to the console only if `synchronizationLoggingEnabled` is `true`.
///
/// - Parameters:
/// - event: A string corresponding to the event to log.
static func synchronizationLog(_ event: String) {
log(handler: synchnronizationLoggingHandler,
isEnabled: synchronizationLoggingEnabled,
event: event,
domain: "Synchronization")
}
}