Nike-Inc / Willow

Willow is a powerful, yet lightweight logging library written in Swift.
MIT License
1.35k stars 80 forks source link

Type not displayed in Console output on Mac for OSLogWriter #67

Open kadanes opened 3 years ago

kadanes commented 3 years ago

I am using Willow v6.0.0. In it, I am creating a release level logger like this:

private static func buildReleaseLogger(name: String) -> Logger {
        guard let bundleIdentifier =  Bundle.main.bundleIdentifier else {
            return buildDebugLogger(name: name)
        }

        let osLogWriter = OSLogWriter(subsystem: bundleIdentifier, category: name)

        let appLogLevels: LogLevel = [.event, .info, .warn, .error]
        let asynchronousExecution: Logger.ExecutionMethod = .asynchronous(
            queue: DispatchQueue(label: "speech-drill.logging", qos: .utility)
        )

        return Logger(logLevels: appLogLevels, writers: [osLogWriter], executionMethod: asynchronousExecution)
}

But when I open the console app on my Mac and change the build configuration to release, I see the type field empty when filtering by subsystem.

image

What am I missing in this setup? I have followed this guide: Convenient Logging in Swift and used the exact same code. The only changes are made in subsystem and queue label names. In the output for the tutorial, you can see the type of log which gets decided by log level. What am I missing?

This configure function is called in application(_:didFinishLaunchingWithOptions:).

static func configure() {

        let name = "Logger"

        #if DEBUG
            willow_logger = buildDebugLogger(name: name)
        #else
            willow_logger = buildReleaseLogger(name: name)
        #endif

        willow_logger?.enabled = true
}