// somewhere in the code to shorten log lines
let domainKey = XCGNSLoggerLogDestination.Constants.userInfoKeyDomain
let imageKey = XCGNSLoggerLogDestination.Constants.userInfoKeyImage
...
logger.info(...., userInfo: [domainKey: "mydomain"])
logger.info(...., userInfo: [imageKey: UIImage(...)])
but I use the optional XCGLogger extension UserInfoTaggingProtocol
pod 'XCGLogger/UserInfoHelpers'
by creating a domain structure
public struct Domain: UserInfoTaggingProtocol {
public var dictionary: [String: String] {
return [XCGNSLoggerLogDestination.Constants.userInfoKeyDomain: name]
}
public init(_ name: String) {
self.name = name
}
public static func name(_ name: String) -> Domain {
return Domain(name)
}
}
and log with it
extension Domain {
static let monitor = Domain("monitor")
static let test = Domain("👷")
static let network = Domain("network")
}
extension Dev {
static let eric = Dev("eric")
}
We could use it like that
but I use the optional XCGLogger extension
UserInfoTaggingProtocol
by creating a domain structure
and log with it
Feel free to change the
Constants,baseIdentifier
valuePS1 : if XCGLogger accept my next PR, I will be able to use also image in tag
PS2: then a subspec of your project could be created dependant on 'XCGLogger/UserInfoHelpers' with Domain and Image structs
PS3: we could also add a userInfo key Marker to call NSLogger function LogMarker