Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

TrackMethod help and overall documentation comment


Can someone provide an example of what ‘methodNameFmt’ should be?

Here is an example from the documentation:

[code]Overloaded. Tracks a method by using a custom log level. The method name consists of a format string and the related array of arguments.

public MethodTracker TrackMethod(Level level, string methodNameFmt, object[] args);[/code]

The documentation in general, tho there is a lot of it, lacks any real details as to usage on some of the overloads.

I checked the included samples and didnt see any that have a call to TrackMethod.

I would like to make a recommendation to include some real examples vs the autogenerated documentation. =)



Hi Eric,

Thanks for your posting and feedback. I understand that more examples would be useful to have. Please note that the actual comments are not auto-generated though and are hand written for the specific methods (though many descriptions are similar of course).

This particular overload basically works like Delphi’s Format method. So instead of just giving the method name, you can use a format string with placeholders (%s etc.) and the related values. This allows you to include the actual method arguments in the string if you like, for example.

I hope this helps.



ah so i can just pass in primitives as arguments? i tried to pass in one of my classes and it kept exploding


Hi Eric,

Sorry, I somehow thought you were using Delphi. Yes, you can only pass in primitives, and the method uses String.Format internally to format the string.

I hope this helps.