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.
- Easier to filter log in both cosole at bottom of
Xcode
andConsole.app
- Easier to shre logs for writing logs into files
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]()
filesToShare.append(url)
let activityViewController = UIActivityViewController(
activityItems: filesToShare,
applicationActivities: nil
)