Hi,
I'm developing a multi-platform project in Windows, Mac and Linux. I am trying to create a wrapper class in Go that will query system information and history.
I see that the Unified Logging System is a sophisticated way to get all sorts of kernel information (and even a long history including rotated logs). However, I am struggling to see how I can use the APIs in other languages aside from Swift itself (or C). I do not want to use the log or last commands to query information in separate child processes in my project. I would like to simply query the database itself, similar to using OSLog in Swift.
If this is something that is entirely proprietary or not possible, let me know :)
There are two parts to this:
-
Adding log points to your code, which log to the system log
-
Getting information back from the system log
The first is tricky. Good integration with the system log requires compiler support. If you were up for modifying the Go compiler, I could help you with the Apple side of that (DTS tends to go the extra mile for folks building developers tools). However, it is by no means an easy task.
Fortunately it sounds like you’re primarily interested in the second part. That’s relatively straightforward. The OSLog
framework is a relatively straightforward Objective-C API. You can call it like you would any other Objective-C API.
I don’t maintain expertise in third-party tools, so I can’t offer advice on how to do that. I recommend that you escalate this via your tool’s support channel.
If there’s no direct support for calling Objective-C APIs in your tools, you could create a bridge from a language that does have such support, including C (Objective-C), C++ (Objective-C++), Swift, and numerous others.
Finally, Your Friend the System Log has lots of hints and tips about the system log.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"