Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
fmt, log: messages are not appearing on device log for darwin/arm,arm64 #12194
Update the x/mobile/example/basic.main to fmt.Println and log.Println.
Build and deploy the app to the device. Run
The expected result is to see "starting" and "log starting messages" to appear, even though there is no output from the example app.
On android we redirect stdout and stderr to logd (the system logger) because there is no way to get access to an app's stdout for debugging on a non-root android phone, the usual development environment.
But that's not so on iOS, where stdout and stderr fit neatly with starting an app from inside Xcode. The attached lldb picks them up and drops them neatly in the output window, interleaved correctly with results from NSLog.
So redirecting os.Stdout and os.Stderr as we do for android would be consistent but an unpleasant development experience, so I think the inconsistency is worth it.
For the log package, there's a question: should we mirror the output to the system log? (We can do so quite easily by calling log.SetOutput(io.MultiWriter(os.Stdout, ...)).) I think we should match the behavior of NSLog here. Does it go to both?
I tested that a log.Printf line in example/basic appeared in the output of idevicesyslog, both starting from lldb and starting the app by clicking on the icon. What are you testing?
(Note that fmt.Printf will not appear in idevicesyslog, as per my comment earlier on this issue.)
I unfortunately can't see the log.Printf output on my device log by starting app by clicking on the icon. This is the main function I am testing:
Do you need any additional information about my device?