-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DX improvements and more info in logs #93
base: master
Are you sure you want to change the base?
Conversation
This way, we avoid other `os_log` calls getting in between `os_log` and `dump` and breaking the association between the two which makes the logs harder to understand.
excluded: | ||
- .build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ought to go in the the remote config, too.
Sources/Track.swift
Outdated
private func os_log_sending_event(_ event: Event, log: OSLog = .tracker, type: OSLogType = .debug) { | ||
var eventDump = DumpOutput() | ||
dump(event.toDict(), to: &eventDump) | ||
os_log("Sending an event from Track:\n%@", log: log, type: type, eventDump.content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: Revisit the os_log
implementation and consider using modern Logger
, see Create a Log Object to Organize Messages, which supports string interpolation.
-scheme ParselyDemo \ | ||
-sdk iphonesimulator \ | ||
-destination 'platform=iOS Simulator,name=$(SIMULATOR_NAME),OS=$(SIMULATOR_OS)' \ | ||
| xcpretty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I verified that this new syntax with the set -o pipefail
in the Make task is still valid in CI:
See #95
mutating func write(_ string: String) { | ||
content.append(string) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this type is needed.
$ swift repl
Welcome to Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4).
Type :help for assistance.
1> var content = ""
content: String = ""
2> dump([1:2], to: &content)
$R0: [Int : Int] = 1 key/value pair {
[0] = {
key = 1
value = 2
}
}
3> print(content)
▿ 1 key/value pair
▿ (2 elements)
- key: 1
- value: 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, 06c8b36 Thanks!
|
||
# Convenience to open the lib and demo project with Xcode, given it's not in the root. | ||
open: | ||
open -a $(XCODE_PATH) ./Demo/ParselyDemo.xcodeproj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an advantage to using this method over xed
?
@@ -82,3 +81,10 @@ class Track { | |||
videoManager.sendHeartbeats() | |||
} | |||
} | |||
|
|||
/// Utitlity to log sending event with a dump of the event. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Utitlity to log sending event with a dump of the event. | |
/// Utility to log sending event with a dump of the event. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @mokagio! 🚀 I made a couple small comments, nothing that blocks.
In trying to help a customer with a question they had, p1731493061054529-slack-C0533SEJ82H, I wanted to look into the logs from the demo app.
In the meantime I noticed a few things the project could use:
Makefile
to use as the single source of truth for the command to test the SDK.editorconfig
, in particular now that Xcode supports it, https://x.com/mokagio/status/1839809925570265100dump
output.