I have tried using OSLog per documentation in both Xcode versions 12.5 and 13 with similar failure:
import SwiftUI
import CoreData
import OSLog
struct IdeaListView: View {
let logger = Logger()
let x = 42
logger.info("The answer is \(x)
How is OSLog supposed to work? I don't see what I am doing wrong.

You should use this
inside a function or a block not in
structlevel , e.x