import Foundation import OSLog final class ClientLogger { let oslog = Logger(subsystem: "another.xmpp", category: "xmpp.client.log") var jid: String = "unknown jid (not set yet)" func logState(_ old: ClientState, _ new: ClientState) { guard old != new else { return } let oldStr = "\(old)" let newStr = "\(new)" let jid = self.jid oslog.debug("\(jid):\nPREV STATE \(oldStr)\nNEW STATE \(newStr)") } func logEvent(_ event: Event) { let jid = self.jid let eventStr = "\(event)" oslog.debug("\(jid): \(eventStr)") } func update(_ jid: String) { self.jid = jid } }