Create custom loggers using a subsystem identifier and a log level.
Add the repository as a dependency:
.package(url: "https://github.com/binarybirds/swift-log-env", from: "1.0.0"),
Add SwiftLogEnv
to the target dependencies:
.product(name: "SwiftLogEnv", package: "swift-log-env"),
Update the packages and you are ready.
Basic example
import SwiftLogEnv
let libLogger = Logger.subsystem("my-lib", .notice)
let appLogger = Logger.subsystem("my-app", .notice)
// LOG_LEVEL=info MY_LIB_LOG_LEVEL=trace swift run MyApp