Skip to content

Commit 0ca4964

Browse files
authored
feat: SDKE-63-replace-logging-macros-with-swift-helpers (#405)
- macroses usage were removed from mparticle.m file - make MPLog methods accessible from objc code - use MPLog methods instead macroses - increase timeout for flaky test
1 parent c50b101 commit 0ca4964

File tree

3 files changed

+110
-61
lines changed

3 files changed

+110
-61
lines changed

UnitTests/MParticleTestsSwift.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class MParticleTestsSwift: XCTestCase {
6868
}
6969
mparticle.identifyNoDispatchCallback(expectedApiResult, error: nil, options: options)
7070

71-
wait(for: [expectation], timeout: 0.1)
71+
wait(for: [expectation], timeout: 1.0)
7272
XCTAssertNil(receivedMessage)
7373
XCTAssertNil(mparticle.deferredKitConfiguration_PRIVATE)
7474
}

mParticle-Apple-SDK/Logger/MPLogger.swift

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
import Foundation
99

10-
public struct MPLog {
10+
@objcMembers
11+
public class MPLog: NSObject {
1112

1213
private static func MPLogger(loggerLevel: MPILogLevel, format: String, arguments: any CVarArg...) {
1314
if (MParticle.sharedInstance().logLevel.rawValue >= loggerLevel.rawValue && loggerLevel != .none) {
@@ -35,4 +36,19 @@ public struct MPLog {
3536
public static func verbose(_ format: String, _ arguments: any CVarArg...) {
3637
MPLogger(loggerLevel: .verbose, format: format, arguments: arguments)
3738
}
39+
40+
@objc
41+
public static func error(message: String) {
42+
error(message)
43+
}
44+
45+
@objc
46+
public static func warning(message: String) {
47+
warning(message)
48+
}
49+
50+
@objc
51+
public static func debug(message: String) {
52+
debug(message)
53+
}
3854
}

0 commit comments

Comments
 (0)