A logging library for ios, with support for printing logs to console, and saving to file summaries. Provides in-app log viewing and log sharing functions.
Xcode
and Console.app
Initialize the log module.
let label = "xyz.123.qqq"
let handler = HadesLogger.hadesHandler(label: label)
log = Logger(label: label, handler)
log.logLevel = .debug
LoggingSystem.bootstrapInternal() { _ in handler }
You can print your logs with these methods (log.debug()
, log.info()
...). It's useful to print logs with category
of metadata when you want to debug code via logs. You can filter logs with category
to focus logs you want.
log.debug("hugo", metadata: ["category": "hugo"])
log.debug("mask", metadata: ["category": "mask"])
log.debug("default")
You can send the zip file to others later if the zip is successful.
let url = try fileLogHandler.zipLogs()
For iOS side, you can share logs through UIActivityViewController
, e.g.
guard let url = try? hadesLogger.zipLogs() else {
return
}
var filesToShare = [Any]src="https://raw.github.com/hugo-h-tang/hades-logger/main/s://raw.github.com/hugo-h-tang/hades-logger/main/)
filesToShare.append(url)
let activityViewController = UIActivityViewController(
activityItems: filesToShare,
applicationActivities: nil
)
link |
Stars: 0 |
Last commit: 1 week ago |
Full Changelog: https://github.com/hugo-h-tang/hades-logger/commits/v0.1
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics