The current logger dependency fails when testing. We can't inspect messages that are logged and this dependency is so ubiquitous that it can be cumbersome to have to override it for every tests. It is thus probably preferable to make this dependency work without failing by default when testing. Users who want to assert that no logging occur can override the \.logger dependency with the .unimplemented value.
This commit also exposes some sugar to directly derive an OSSignposter value from a Logger. Its API suffers the same limitations of Logger regarding privacy, so, like Logger, we can't create a configurable/inspectable wrapper of this type. For this reason, the dependency directly produces an OSSignposter value.
You can use the provided subscript to emit signposts on any subsystem/category:
@Dependency(\.logger["Billing"].signpost) var signpost
signpost.emitEvent(
"Purchase successful",
"User \(userID, privacy: .private(mask: .hash)) did purchase item \(item, privacy: .auto)"
)
The current logger dependency fails when testing. We can't inspect messages that are logged and this dependency is so ubiquitous that it can be cumbersome to have to override it for every tests. It is thus probably preferable to make this dependency work without failing by default when testing. Users who want to assert that no logging occur can override the
\.logger
dependency with the.unimplemented
value.This commit also exposes some sugar to directly derive an
OSSignposter
value from aLogger
. Its API suffers the same limitations ofLogger
regarding privacy, so, likeLogger
, we can't create a configurable/inspectable wrapper of this type. For this reason, the dependency directly produces anOSSignposter
value.You can use the provided subscript to emit signposts on any subsystem/category: