Skip to content

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

Description

@kadanes

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
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions