Skip to content
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

Add unified logging #19

Open
pj4533 opened this issue Apr 16, 2023 · 1 comment
Open

Add unified logging #19

pj4533 opened this issue Apr 16, 2023 · 1 comment
Labels
P3 Lower priority

Comments

@pj4533
Copy link
Owner

pj4533 commented Apr 16, 2023

Replace my current debug logging with the proper API

https://developer.apple.com/documentation/os/logging

@pj4533 pj4533 added the P3 Lower priority label Apr 16, 2023
@pj4533
Copy link
Owner Author

pj4533 commented Apr 16, 2023

Support easy debugging of json responses too like this:

                do {
                    // Attempt to deserialize the Data object to a JSON object
                    let jsonObject = try JSONSerialization.jsonObject(with: data, options: [])

                    // Convert the JSON object to a pretty-printed string
                    let decodedJsonData = try JSONSerialization.data(withJSONObject: jsonObject, options: [.prettyPrinted])
                    DebugLog.shared.log(String(data: decodedJsonData, encoding: .utf8) ?? "")
                } catch {
                    print("Error converting Data to JSON decoded string: \(error)")
                }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Lower priority
Projects
None yet
Development

No branches or pull requests

1 participant