paulw11 / Seam3

Cloudkit based persistent store for Core Data
Other
209 stars 25 forks source link

Too much logging for me to digest. #122

Closed daviddelmonte closed 5 years ago

daviddelmonte commented 5 years ago

I'm getting a slew of logs, that do not appear to be useful to me. Is there a way to suppress logging, just showing me errors and warnings?

Here's a very small example of the logs...

2019-10-22 08:41:06.188975-0400 Pragmata[18867:806856] OK Saved CKServerChangeToken: <CKServerChangeToken: 0x60000001d5a0; data=AQAAAAAAAAlQf/////////9qjIXhldhG3I+m5CtYnJ+a>
2019-10-22 08:41:06.189176-0400 Pragmata[18867:806856] OK (sync operation) fetchRecordZoneChangesCompletionBlock returned with no error
2019-10-22 08:41:06.290495-0400 Pragmata[18867:806835] OK (sync operation) cloud changes detected: 4 insertedOrUpdated
["AA7C09FC-67A6-49A7-B355-91AF0425BBF3", "D2B1A89F-E47F-4425-A7C6-F7FC71986625", "26CE11AB-91DA-4769-982D-4AB9FE9FC7ED", "3C027428-B816-4E15-977A-4DA0EB0C0F5E"]
2019-10-22 08:41:06.292186-0400 Pragmata[18867:806835] OK (sync operation) cloud changes detected: 384 deleted
["001233E8-5371-484C-9D6B-BDB39EF8DECF", "AB79A65E-8268-4671-A7FC-7BB408E0E480", "4B92E82F-348F-49C3-B0BF-66D3A8885906", "4D5E8E77-EC7C-4977-9625-B64C72CCC6B8", "439D2506-F6DF-47EC-A216-5F08095DA242", "982523F6-DCCD-4882-B682-D36DFA8ED438", "286B37F6-BDDC-4D1C-82C9-A80549B54765", "0F4F50CE-B9B1-493A-9095-236E236B64E9", "B5ED0AB4-6EB9-4C1C-AE73-86A01CE82495", "454B3ABE-B755-45DD-9134-491E432AC2D9", "2010829B-B971-44EB-8C94-4C78E7E422F8", "70A5E139-E4F6-4B83-B406-83126D4C4E16",  

all these times 50....

 "3DEBAC03-B864-47E5-8453-4E8AFEC78066", "3040BBF2-15DD-4576-8009-CA8DFC1CF0F1", "4BB46BD3-F46A-48C9-B536-C7C8C586F1EC", "AF9B97BF-6114-4D51-948B-34D8F5D7111F", "A8CDE8BA-EF06-4013-BDE5-843FD25B9127", "0369C88A-798F-4DC1-93FE-6387DBFB0952", "CA1FD017-6F88-4E06-A101-FC857D74F1B6", "9EB75170-7C2A-4803-B237-C6F827DE4B79", "860E347E-71AB-4C89-B9C8-2D5EF1D4207E", "49CE953C-5266-4EF4-A3CB-FE2C93D36C69", "59AD8803-5754-47FF-A5F7-F0B1E5D80C4A", "190F414E-239E-4408-A330-DD699479B557", "CC719501-F42F-4A77-A568-500BAB0011CC", "B8AB88F0-E6AC-45AB-9824-632D86DC691A", "1B336735-E944-47C2-9A7A-4632669EC9FE", "2566C159-BCDB-4DD6-9FB6-C314B7CE6DD7", "CF55920B-CA45-4AB2-BC5B-37B22264FDC8", "C751137E-1541-4A9C-8A12-CC5C56CB815B", "083A49C0-7153-4FD3-A946-DB994344BC57", "84B4DFD6-37D2-4038-9D63-147E80429938", "2A1F3B64-0E5A-48D6-8400-12DC9D9E1FA4", "8021BFB8-010D-474C-A0E9-BBD14046208F", "E43A8CBD-0EB2-4442-A201-C58D4C6B6FED", "3ACDC095-22D2-4C87-AA9C-D80D26869A13", "CEEC8E5C-C29B-47BB-AD39-32299EE39493", "E0101787-7C60-47F5-A275-61A22744CD84", "CE71E0C4-67D3-4D35-A530-ADD7F5D01612", "EC644810-021F-4F9B-A0AB-3B9E8DA07493", "0AA26DC5-53AF-4E03-8091-5D1E9DB7B9DF", "9CA7C106-373C-4F73-9CE7-232CB5EA158D", "49D59A1B-D3D6-4C67-9602-62D3F39A12B5", "E6542D2C-D7B8-417D-B89D-5916D15B7415"]
2019-10-22 08:41:06.335410-0400 Pragmata[18867:806835] OK Committed CKServerChangeToken to userDefault: <CKServerChangeToken: 0x60000001d5a0; data=AQAAAAAAAAlQf/////////9qjIXhldhG3I+m5CtYnJ+a>
2019-10-22 08:41:06.336289-0400 Pragmata[18867:806835] Sync completed successfully
2019-10-22 08:41:06.336414-0400 Pragmata[18867:806854] Cloud Sync Started
2019-10-22 08:41:06.340652-0400 Pragmata[18867:806854] Local insert/update changes detected: 1 insertedOrUpdated
["493304AA-93C4-44C5-AA9B-FF48200131D2"]
2019-10-22 08:41:06.340733-0400 Pragmata[18867:806854] Local delete changes detected: 0 deleted
[

all these * 50

2019-10-22 08:41:06.340798-0400 Pragmata[18867:806854] Will attempt saving (insert/update) to the cloud 1 CKRecords ["493304AA-93C4-44C5-AA9B-FF48200131D2"]
2019-10-22 08:41:06.340846-0400 Pragmata[18867:806854] Will attempt deleting from the cloud 0 CKRecords []
2019-10-22 08:41:06.795949-0400 Pragmata[18867:806856] OK Completed CKRecord operation (change/insert or delete to the cloud) for 493304AA-93C4-44C5-AA9B-FF48200131D2
2019-10-22 08:41:06.796323-0400 Pragmata[18867:806854] Uploaded 1 inserts/updates and 0 deletes to the cloud

data=AQAAAAAAAAlRf/////////9qjIXhldhG3I+m5CtYnJ+a>), clientChangeTokenData=nil
2019-10-22 08:41:07.056478-0400 Pragmata[18867:806835] OK Saved CKServerChangeToken: <CKServerChangeToken: 0x60000001d780; data=AQAAAAAAAAlRf/////////9qjIXhldhG3I+m5CtYnJ+a>
2019-10-22 08:41:07.056982-0400 Pragmata[18867:806856] OK (sync operation) fetchRecordZoneChangesCompletionBlock returned with no error
2019-10-22 08:41:07.329326-0400 Pragmata[18867:806854] OK (sync operation) cloud changes detected: 1 insertedOrUpdated
["493304AA-93C4-44C5-AA9B-FF48200131D2"]
2019-10-22 08:41:07.329429-0400 Pragmata[18867:806854] OK (sync operation) cloud chang
literalpie commented 5 years ago

As mentioned in the readme, you can make a delegate that handles logs.

This is what I did to only log errors and faults:

class AppDelegate: UIResponder, UIApplicationDelegate, SMLogDelegate {
    func log(_ message: @autoclosure () -> String, type: SMLogType) {}

    func info(_ message: @autoclosure () -> String) {}

    func debug(_ message: @autoclosure () -> String) {}

    func error(_ message: @autoclosure () -> String) {
        print("seam error \(message())")
    }

    func fault(_ message: @autoclosure () -> String) {
        print("seam fault \(message())")
    }

    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
    ) -> Bool {
        SMStore.logger = self
        ...
    }
    ...
}
daviddelmonte commented 5 years ago

Ah. that's great. Thanks