Reputation: 2741
In Xamarin, I'm often using the Console (WriteLine) to debug an application.
Is this possible to write some lines directly to a file somewhere on the host machine instead of using the Console to debug? I don't want to write a file on the phone as I'll use this file in realtime on the development machine.
Upvotes: 2
Views: 1978
Reputation: 19335
The easy way:
On your host, execute this:
/Developer/MonoTouch/usr/bin/mtouch --logdev > ~/myfile.log
And now your Console.WriteLine output will end up in ~/myfile.log
. The downside is that you'll get everything written to the Device Log, both from iOS itself and any other apps (this can be significant sometimes). However it should be possible to filter out only your output by some clever grep usage.
The more involved approach would be to redirect Console.WriteLine output to some sort of network stream that sends the data over wifi to the host machine (or a web service for instance).
The easy part is to redirect Console.WriteLine output:
Console.SetOut (myNetworkStream);
The rest will be left as an exercise for the reader, since that wasn't part of the question :)
Upvotes: 2