Logger and signposts?

I've been using the os.Logger API, but it looks like I need to create an OSLog as well if I want to use the signpost API for tracking performance.

Is that true, or is there some way get an underlying OSLog from a Logger? Then I could write something like:

Code Block swift
extension os.Logger {
func signpost(...) {
os_signpost(.begin, ... self.osLog, ...)
}
}

Answered by DTS Engineer in 670417022

it looks like I need to create an OSLog as well if I want to use the
signpost API for tracking performance.

Correct. Normally I’d suggest that you file an enhancement request for a Swift-y signpost API but in this case I can assure you that the team fully understands this requirement (r. 74617206).

is there some way get an underlying OSLog from a Logger?

There is not. There is a way to construct a Logger from an OSLog, namely Logger(_:), but I don’t think that gets you where you want to be.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Accepted Answer

it looks like I need to create an OSLog as well if I want to use the
signpost API for tracking performance.

Correct. Normally I’d suggest that you file an enhancement request for a Swift-y signpost API but in this case I can assure you that the team fully understands this requirement (r. 74617206).

is there some way get an underlying OSLog from a Logger?

There is not. There is a way to construct a Logger from an OSLog, namely Logger(_:), but I don’t think that gets you where you want to be.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
Logger and signposts?
 
 
Q