Creating Stats on Method Hits

Bit of a strange one, but I am looking to have a method:


That would simply return statistical information on how many times certain processes are done. I was thinking the best way to do this would be to use a KVP system and every time a method is called simply increment it by one.

So I would have:


This would go to the KVP look for the Matrix entry and update it's pairby one. Just making sure there really isnt an easier way before I put this all throughout my code.

Who is Participating?
JimBrandleyConnect With a Mentor Commented:
We use a product called NLog. It's free and very capable.
In addition to counts, it can log errors debug info etc. It is configured with XML so you can turn it on and off at any given installation as needed.

directxBOBAuthor Commented:
Cheers Jim, I am already using NLog for tracing, errors and debuging.

That said the purpose of this method is to actually determine the status of the application. So for example it will have the last error, what parts of the application is offline etc.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.