This library will make you log with a single line with all benefits of os.Logging, swift-log features.
If you have a server-side Swift application, or maybe a cross-platform (for example Linux & macOS) app/library, and you would like to log, we think targeting this logging API package is a great idea. Below you'll find all you need to know to get started.
swift-unified-log is designed for Swift 5.3 and later. To depend on the logging API package, you need to declare your dependency in your
.package(url: "https://github.com/sinoru/swift-unified-log.git", from: "2.0.0"),
and to your application/library target, add
"UnifiedLogging" to your
dependencies, e.g. like this:
.target(name: "BestExampleApp", dependencies: [ .product(name: "UnifiedLogging", package: "swift-unified-log") ],
// 1) let's import the logging API package import UnifiedLogging // 2) we need to create a logger let logger = Logger() // 3) we're now ready to use it logger.log(level: .info, "Hello World!")