天天看點

Windows Phone 實用開發技巧(22):使用日志記錄目前資訊與異常資訊

What is logging ?

Why to use logging ? 

Here I created a helper class to do better and easier logging.

We can log common information as well as Exception simply by pass different parameter. We can also log device information since it may be help in finding which device goes wrong. 

How to use it ?

First, we should add dll reference to our main project, shown as follow:

After that, we manually generate a DivideBvZeroException, shown as below: 

Here, I use LoggingHelper(shown before) class  to log exception.As we run the app, we can find exception both in output and log.dat which is the file store logging.

    本文轉自xshf12345 51CTO部落格,原文連結:http://blog.51cto.com/alexis/672033,如需轉載請自行聯系原作者

繼續閱讀