Skip to content
Csaba Nemes edited this page May 17, 2015 · 7 revisions

Getting started with Tracer.Fody

To get started with using Tracer.Fody all you need to do is reference a Tracer adapter NuGet package (like Tracer.Log4Net.Fody) into your project. It will automatically bring in Tracer.Fody to do the actual weaving whenever you build the project. Don't forget to configure your actual logging framework (e.g. call Configure for log4Net).

Trace enter and leave calls will be added automatically to all public methods of public classes. As their name suggests trace enter and leave are trace level messages so once you configure the actual logger for trace level or lower the corresponding log entries will be there in the log. Trace enter writes information about the actual method and all its arguments. Trace leave logs the return value and the time spent in the method.

The Tracer will also rewrite static log calls to proper log calls. For Tracer.Log4Net.Fody for example you might write Log.InfoFormat("MyValue is {0}", myValue); which will be changed to a call on the actual logger assigned to the class.

For more details on how-to configure see the Basics page.

To write your own adapter see Create your own adapter.

Actually it is very easy to build one and you will have complete control on logging output and on logging methods.