eclipse/paho.mqtt.m2mqtt

Trace example under .Netmf ?

nlsa opened this issue · 1 comments

nlsa commented

I need to implement M2MQTT's Trace under .NETmf but I don't understand how to assign the TraceListener. The only example that I have found uses a Lambda expression which is not available on the .NET micro framework.
MqttUtility.Trace.TraceListener = (f, a) => System.Diagnostics.Trace.WriteLine(System.String.Format(f, a))
Could someone please show me how to direct Trace to the VS debugger?
Thank you

@nlsa if you were using .NET nanoFramework you could add this to your project:

        static void WriteTrace(string format, params object[] args)
        {
            Console.WriteLine(string.Format(format, args));
        }

and then configure the TraceListener like this:

MqttUtility.Trace.TraceListener = WriteTrace;

If you are not, please take a look and consider it to upgrade your current .NETMF projects. You'll find yourself at home. 😉