another.im-ios/AnotherIM/xmpp/modules/session/Logger.swift
2024-12-16 08:19:58 +01:00

26 lines
669 B
Swift

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
}
}