Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug.WriteLine equivalent in MonoTouch/MonoDroid?

What's the equivalent to Debug.WriteLine for MonoTouch or MonoDroid?

Here's a guide for MonoDroid: http://monodroid.net/Documentation/Guides/Android_Debug_Log

like image 263
James Cadd Avatar asked Jan 06 '11 18:01

James Cadd


People also ask

Where can I find debug WriteLine?

Diagnostics. Debug. WriteLine will display in the output window ( Ctrl + Alt + O ), you can also add a TraceListener to the Debug.

What is debug WriteLine?

WriteLine(String) Writes a message followed by a line terminator to the trace listeners in the Listeners collection. WriteLine(Object) Writes the value of the object's ToString() method to the trace listeners in the Listeners collection.

Where does console WriteLine go C#?

It goes to the console (standard output) or to the stream that the console is set to.


2 Answers

For MonoTouch, Console.WriteLine will show up in MonoDevelop and in the logs from your iOS device.

For MonoDroid, you can use the Android.Util.Log class to log debug, info, errors etc that you can view from the Android Debug Bridge's logcat (adb logcat). An example would be something like this to log an info message : Android.Util.Log.Info("Barcode", "Scan button pressed.")

like image 118
Kevin McMahon Avatar answered Sep 20 '22 14:09

Kevin McMahon


Mono for Android provides Debug.WriteLine(), as does MonoTouch, so I'm not sure why you need a workaround.

Debug.WriteLine() is visible within MonoDevelop (when debugging) and is also copied to the Android Debug Log with the mono-stdout tag. System.Console output is also copied to the Android Debug Log with the mono-stdout (Console.Out) and mono-stderr (Console.Error) tags.

like image 32
jonp Avatar answered Sep 16 '22 14:09

jonp