How access an NSLOG output from an Swift App?

i use this code an in swift app (XCODE, named Nbody-Metal) to print out the result of measured gigaflops.
… swift code…
if frames_runs == 10 {
NSLog (“HUHU Flops :%f”, gflops)

How can i access that swift app NSLOG output from an XOJO app (i have MBS Plugins also)?

I can see the GFlops result by running the mac console app
show up in “Devices/MyComputerName”
with timestamp , Nbody-Metal as Name and the result.

But how can i access this message? - its not in the file system.log (OS X Monterey).

Or is there an other way to communicate between that swift app and the Xoja Mac App not using an file or the NSLOG message ?
That Nbody-Metal swift App will be started by the xojo App - can i perhaps transfer the result (as floadt or text) by an argument the swift app gives the xojo app at exit?

i have souce code, but very less swift/Objetice C knowledge).

Use “print” instead of “NSLog” so that the Swift app does write the output to stdout. So you can just call it via shell class and read the output.


This is the way.

Also worth mentioning is that “standard” user accounts prevent apps from reading the log. The App Sandbox, required for the Mac App Store, prevents an app from reading the logs too.

Hi, many thanks for that hint. Using print insted of NSLog for “sending” the result.
I already use this way of shell class to run a command line program and get values from this command line program using shell class. Works.

But now i have to start an swift app , not an command line app. Is the start the same of the .app the same as staring an command line programm. I will have the .app within the Xojo App of course not calling an external .app (like calling which resides in /programs, not within the packadge structure of the xojo main app.
How to start such an .app by the shell?

/My Great

1 Like