Skip to content

Commit 4b58a6c

Browse files
committed
Revert "rename with MP prefix to avoid namespace clashes"
This reverts commit 3485742.
1 parent 27ce786 commit 4b58a6c

15 files changed

+122
-122
lines changed

Mixpanel.xcodeproj/project.pbxproj

+10-10
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
17C6547B2BB1F16000C8A126 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 1728208D2BA8BDE4002CD973 /* PrivacyInfo.xcprivacy */; };
1212
17C6547C2BB1F16400C8A126 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 1728208D2BA8BDE4002CD973 /* PrivacyInfo.xcprivacy */; };
1313
17C6547D2BB1F16800C8A126 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 1728208D2BA8BDE4002CD973 /* PrivacyInfo.xcprivacy */; };
14-
17C9D9082D4C170C008F04BB /* MPLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17C9D9072D4C170C008F04BB /* MPLogger.swift */; };
15-
17C9D9092D4C170C008F04BB /* MPLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17C9D9072D4C170C008F04BB /* MPLogger.swift */; };
16-
17C9D90A2D4C170C008F04BB /* MPLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17C9D9072D4C170C008F04BB /* MPLogger.swift */; };
17-
17C9D90B2D4C170C008F04BB /* MPLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17C9D9072D4C170C008F04BB /* MPLogger.swift */; };
14+
51DD567C1D306B740045D3DB /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51DD56791D306B740045D3DB /* Logger.swift */; };
1815
51DD56831D306B7B0045D3DB /* PrintLogging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51DD56801D306B7B0045D3DB /* PrintLogging.swift */; };
1916
51DD56841D306B7B0045D3DB /* FileLogging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51DD56811D306B7B0045D3DB /* FileLogging.swift */; };
2017
673ABE3A21360CBE00B1784B /* Group.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673ABE3921360CBE00B1784B /* Group.swift */; };
@@ -31,6 +28,7 @@
3128
86F86EB7224439D300B69832 /* Mixpanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E115948A1CFF1538007F8B4F /* Mixpanel.swift */; };
3229
86F86EB8224439D300B69832 /* MixpanelInstance.swift in Sources */ = {isa = PBXBuildFile; fileRef = E115948D1D000709007F8B4F /* MixpanelInstance.swift */; };
3330
86F86EB9224439DC00B69832 /* AutomaticProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1D335CF1D3059A800E68E12 /* AutomaticProperties.swift */; };
31+
86F86EBA224439E300B69832 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51DD56791D306B740045D3DB /* Logger.swift */; };
3432
86F86EBB224439EB00B69832 /* FlushRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1D335CB1D303A0D00E68E12 /* FlushRequest.swift */; };
3533
86F86EBC224439F100B69832 /* PrintLogging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51DD56801D306B7B0045D3DB /* PrintLogging.swift */; };
3634
86F86EBD224439F500B69832 /* Flush.swift in Sources */ = {isa = PBXBuildFile; fileRef = E115949E1D01BE14007F8B4F /* Flush.swift */; };
@@ -57,6 +55,7 @@
5755
E11594A11D01C597007F8B4F /* Track.swift in Sources */ = {isa = PBXBuildFile; fileRef = E11594A01D01C597007F8B4F /* Track.swift */; };
5856
E12782BB1D4AB5CB0025FB05 /* PrintLogging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51DD56801D306B7B0045D3DB /* PrintLogging.swift */; };
5957
E12782BC1D4AB5CB0025FB05 /* FileLogging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51DD56811D306B7B0045D3DB /* FileLogging.swift */; };
58+
E12782BD1D4AB5CB0025FB05 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51DD56791D306B740045D3DB /* Logger.swift */; };
6059
E12782BE1D4AB5CB0025FB05 /* Mixpanel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E115948A1CFF1538007F8B4F /* Mixpanel.swift */; };
6160
E12782BF1D4AB5CB0025FB05 /* MixpanelInstance.swift in Sources */ = {isa = PBXBuildFile; fileRef = E115948D1D000709007F8B4F /* MixpanelInstance.swift */; };
6261
E12782C11D4AB5CB0025FB05 /* Network.swift in Sources */ = {isa = PBXBuildFile; fileRef = E11594961D006022007F8B4F /* Network.swift */; };
@@ -86,6 +85,7 @@
8685
E1F15FD61E64B5FC00391AE3 /* FlushRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1D335CB1D303A0D00E68E12 /* FlushRequest.swift */; };
8786
E1F15FD71E64B60200391AE3 /* PrintLogging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51DD56801D306B7B0045D3DB /* PrintLogging.swift */; };
8887
E1F15FD81E64B60200391AE3 /* FileLogging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51DD56811D306B7B0045D3DB /* FileLogging.swift */; };
88+
E1F15FD91E64B60600391AE3 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51DD56791D306B740045D3DB /* Logger.swift */; };
8989
E1F15FDA1E64B60A00391AE3 /* JSONHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = E11594981D01689F007F8B4F /* JSONHandler.swift */; };
9090
E1F15FDB1E64B60A00391AE3 /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1982BFE1D0AC2E2006B7330 /* Error.swift */; };
9191
E1F15FDC1E64B60A00391AE3 /* AutomaticProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1D335CF1D3059A800E68E12 /* AutomaticProperties.swift */; };
@@ -100,7 +100,7 @@
100100

101101
/* Begin PBXFileReference section */
102102
1728208D2BA8BDE4002CD973 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = Sources/Mixpanel/PrivacyInfo.xcprivacy; sourceTree = SOURCE_ROOT; };
103-
17C9D9072D4C170C008F04BB /* MPLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MPLogger.swift; sourceTree = "<group>"; };
103+
51DD56791D306B740045D3DB /* Logger.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = "<group>"; };
104104
51DD56801D306B7B0045D3DB /* PrintLogging.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrintLogging.swift; sourceTree = "<group>"; };
105105
51DD56811D306B7B0045D3DB /* FileLogging.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileLogging.swift; sourceTree = "<group>"; };
106106
673ABE3921360CBE00B1784B /* Group.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Group.swift; sourceTree = "<group>"; };
@@ -173,8 +173,8 @@
173173
51DD56771D306B620045D3DB /* Log */ = {
174174
isa = PBXGroup;
175175
children = (
176-
17C9D9072D4C170C008F04BB /* MPLogger.swift */,
177176
51DD56781D306B6B0045D3DB /* Logging */,
177+
51DD56791D306B740045D3DB /* Logger.swift */,
178178
);
179179
name = Log;
180180
sourceTree = "<group>";
@@ -479,7 +479,6 @@
479479
86F86EF7224554B900B69832 /* Group.swift in Sources */,
480480
86F86ECA22443A4C00B69832 /* SessionMetadata.swift in Sources */,
481481
86F86EC922443A4700B69832 /* Constants.swift in Sources */,
482-
17C9D90A2D4C170C008F04BB /* MPLogger.swift in Sources */,
483482
86F86EC722443A3C00B69832 /* FileLogging.swift in Sources */,
484483
86F86EC622443A3100B69832 /* Error.swift in Sources */,
485484
86F86EC522443A2C00B69832 /* People.swift in Sources */,
@@ -493,6 +492,7 @@
493492
86F86EBC224439F100B69832 /* PrintLogging.swift in Sources */,
494493
868550AF2699096F001FCDDC /* MixpanelPersistence.swift in Sources */,
495494
86F86EBB224439EB00B69832 /* FlushRequest.swift in Sources */,
495+
86F86EBA224439E300B69832 /* Logger.swift in Sources */,
496496
86F86EB9224439DC00B69832 /* AutomaticProperties.swift in Sources */,
497497
86F86F3722497F2900B69832 /* AutomaticEvents.swift in Sources */,
498498
86F86EB7224439D300B69832 /* Mixpanel.swift in Sources */,
@@ -514,8 +514,8 @@
514514
673ABE3A21360CBE00B1784B /* Group.swift in Sources */,
515515
E11594A11D01C597007F8B4F /* Track.swift in Sources */,
516516
E11594991D01689F007F8B4F /* JSONHandler.swift in Sources */,
517-
17C9D9092D4C170C008F04BB /* MPLogger.swift in Sources */,
518517
E1D335D01D3059A800E68E12 /* AutomaticProperties.swift in Sources */,
518+
51DD567C1D306B740045D3DB /* Logger.swift in Sources */,
519519
E165228F1D6781DF000D5949 /* MixpanelType.swift in Sources */,
520520
BB9614171F3BB87700C3EF3E /* ReadWriteLock.swift in Sources */,
521521
E190522D1F9FC1BC00900E5D /* SessionMetadata.swift in Sources */,
@@ -535,7 +535,7 @@
535535
67FF65E521878416005161FA /* Group.swift in Sources */,
536536
E12782BB1D4AB5CB0025FB05 /* PrintLogging.swift in Sources */,
537537
E12782BC1D4AB5CB0025FB05 /* FileLogging.swift in Sources */,
538-
17C9D9082D4C170C008F04BB /* MPLogger.swift in Sources */,
538+
E12782BD1D4AB5CB0025FB05 /* Logger.swift in Sources */,
539539
E12782BE1D4AB5CB0025FB05 /* Mixpanel.swift in Sources */,
540540
E12782BF1D4AB5CB0025FB05 /* MixpanelInstance.swift in Sources */,
541541
E12782C11D4AB5CB0025FB05 /* Network.swift in Sources */,
@@ -563,8 +563,8 @@
563563
67FF65E421878414005161FA /* Group.swift in Sources */,
564564
E1F15FE01E64B60D00391AE3 /* MixpanelInstance.swift in Sources */,
565565
E1F15FDF1E64B60D00391AE3 /* Mixpanel.swift in Sources */,
566-
17C9D90B2D4C170C008F04BB /* MPLogger.swift in Sources */,
567566
E1F15FDC1E64B60A00391AE3 /* AutomaticProperties.swift in Sources */,
567+
E1F15FD91E64B60600391AE3 /* Logger.swift in Sources */,
568568
E1F15FD61E64B5FC00391AE3 /* FlushRequest.swift in Sources */,
569569
E1F15FD71E64B60200391AE3 /* PrintLogging.swift in Sources */,
570570
8625BEBD26D045CE0009BAA9 /* MPDB.swift in Sources */,

MixpanelDemo/MixpanelDemoTests/LoggerTests.swift

+23-23
Original file line numberDiff line numberDiff line change
@@ -15,63 +15,63 @@ class LoggerTests: XCTestCase {
1515

1616
func testEnableDebug() {
1717
let counter = CounterLogging()
18-
MPLogger.addLogging(counter)
19-
MPLogger.enableLevel(.debug)
18+
Logger.addLogging(counter)
19+
Logger.enableLevel(.debug)
2020

21-
MPLogger.debug(message: "logged")
21+
Logger.debug(message: "logged")
2222
XCTAssertEqual(1, counter.count)
2323
}
2424

2525
func testEnableInfo() {
2626
let counter = CounterLogging()
27-
MPLogger.addLogging(counter)
28-
MPLogger.enableLevel(.info)
29-
MPLogger.info(message: "logged")
27+
Logger.addLogging(counter)
28+
Logger.enableLevel(.info)
29+
Logger.info(message: "logged")
3030
XCTAssertEqual(1, counter.count)
3131
}
3232

3333
func testEnableWarning() {
3434
let counter = CounterLogging()
35-
MPLogger.addLogging(counter)
36-
MPLogger.enableLevel(.warning)
37-
MPLogger.warn(message: "logged")
35+
Logger.addLogging(counter)
36+
Logger.enableLevel(.warning)
37+
Logger.warn(message: "logged")
3838
XCTAssertEqual(1, counter.count)
3939
}
4040

4141
func testEnableError() {
4242
let counter = CounterLogging()
43-
MPLogger.addLogging(counter)
44-
MPLogger.enableLevel(.error)
45-
MPLogger.error(message: "logged")
43+
Logger.addLogging(counter)
44+
Logger.enableLevel(.error)
45+
Logger.error(message: "logged")
4646
XCTAssertEqual(1, counter.count)
4747
}
4848

4949
func testDisabledLogging() {
5050
let counter = CounterLogging()
51-
MPLogger.addLogging(counter)
52-
MPLogger.disableLevel(.debug)
53-
MPLogger.debug(message: "not logged")
51+
Logger.addLogging(counter)
52+
Logger.disableLevel(.debug)
53+
Logger.debug(message: "not logged")
5454
XCTAssertEqual(0, counter.count)
5555

56-
MPLogger.disableLevel(.error)
57-
MPLogger.error(message: "not logged")
56+
Logger.disableLevel(.error)
57+
Logger.error(message: "not logged")
5858
XCTAssertEqual(0, counter.count)
5959

60-
MPLogger.disableLevel(.info)
61-
MPLogger.info(message: "not logged")
60+
Logger.disableLevel(.info)
61+
Logger.info(message: "not logged")
6262
XCTAssertEqual(0, counter.count)
6363

64-
MPLogger.disableLevel(.warning)
65-
MPLogger.warn(message: "not logged")
64+
Logger.disableLevel(.warning)
65+
Logger.warn(message: "not logged")
6666
XCTAssertEqual(0, counter.count)
6767
}
6868
}
6969

7070
/// This is a stub that implements `Logging` to be passed to our `Logger` instance for testing
71-
class CounterLogging: MPLogging {
71+
class CounterLogging: Logging {
7272
var count = 0
7373

74-
func addMessage(message: MPLogMessage) {
74+
func addMessage(message: LogMessage) {
7575
count = count + 1
7676
}
7777
}

Sources/Error.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ErrorHandler {
3636

3737
class func logError(_ error: Error) {
3838
let stackSymbols = Thread.callStackSymbols
39-
MPLogger.error(message: "Error: \(error) \n Stack Symbols: \(stackSymbols)")
39+
Logger.error(message: "Error: \(error) \n Stack Symbols: \(stackSymbols)")
4040
}
4141

4242
}

Sources/FileLogging.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Foundation
1010

1111
/// Logs all messages to a file
12-
class FileLogging: MPLogging {
12+
class FileLogging: Logging {
1313
private let fileHandle: FileHandle
1414

1515
init(path: String) {
@@ -28,7 +28,7 @@ class FileLogging: MPLogging {
2828
fileHandle.closeFile()
2929
}
3030

31-
func addMessage(message: MPLogMessage) {
31+
func addMessage(message: LogMessage) {
3232
let string = "File: \(message.file) - Func: \(message.function) - " +
3333
"Level: \(message.level.rawValue) - Message: \(message.text)"
3434
if let data = string.data(using: String.Encoding.utf8) {

Sources/Flush.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ class Flush: AppLifecycle {
122122
(entity["id"] as? Int32) ?? 0
123123
}
124124
// Log data payload sent
125-
MPLogger.debug(message: "Sending batch of data")
126-
MPLogger.debug(message: batch as Any)
125+
Logger.debug(message: "Sending batch of data")
126+
Logger.debug(message: batch as Any)
127127
let requestData = JSONHandler.encodeAPIData(batch)
128128
if let requestData = requestData {
129129
#if os(iOS)

Sources/FlushRequest.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ class FlushRequest: Network {
6565
failure: { (reason, _, response) in
6666
self.networkConsecutiveFailures += 1
6767
self.updateRetryDelay(response)
68-
MPLogger.warn(message: "API request to \(resource.path) has failed with reason \(reason)")
68+
Logger.warn(message: "API request to \(resource.path) has failed with reason \(reason)")
6969
completion(false)
7070
}, success: { (result, response) in
7171
self.networkConsecutiveFailures = 0
7272
self.updateRetryDelay(response)
7373
if result == 0 {
74-
MPLogger.info(message: "\(base) api rejected some items")
74+
Logger.info(message: "\(base) api rejected some items")
7575
}
7676
completion(true)
7777
})

Sources/JSONHandler.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class JSONHandler {
1616
let data: Data? = serializeJSONObject(obj)
1717

1818
guard let d = data else {
19-
MPLogger.warn(message: "couldn't serialize object")
19+
Logger.warn(message: "couldn't serialize object")
2020
return nil
2121
}
2222

@@ -28,7 +28,7 @@ class JSONHandler {
2828
do {
2929
object = try JSONSerialization.jsonObject(with: data, options: [])
3030
} catch {
31-
MPLogger.warn(message: "exception decoding object data")
31+
Logger.warn(message: "exception decoding object data")
3232
}
3333
return object
3434
}
@@ -44,7 +44,7 @@ class JSONHandler {
4444
}
4545

4646
guard JSONSerialization.isValidJSONObject(serializableJSONObject) else {
47-
MPLogger.warn(message: "object isn't valid and can't be serialzed to JSON")
47+
Logger.warn(message: "object isn't valid and can't be serialzed to JSON")
4848
return nil
4949
}
5050

@@ -53,7 +53,7 @@ class JSONHandler {
5353
serializedObject = try JSONSerialization
5454
.data(withJSONObject: serializableJSONObject, options: [])
5555
} catch {
56-
MPLogger.warn(message: "exception encoding api data")
56+
Logger.warn(message: "exception encoding api data")
5757
}
5858
return serializedObject
5959
}
@@ -110,7 +110,7 @@ class JSONHandler {
110110
// all nil properties outside of Arrays are converted to NSNull()
111111
return NSNull()
112112
} else {
113-
MPLogger.info(message: "enforcing string on object")
113+
Logger.info(message: "enforcing string on object")
114114
return objString
115115
}
116116
}

0 commit comments

Comments
 (0)