- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
𝗕𝗲𝗻𝗰𝗵𝗺𝗮𝗿𝗸 𝗺𝗲𝘁𝗵𝗼𝗱𝘀 𝗼𝗻 𝘁𝗵𝗲 𝗳𝗹𝘆 with MethodTimer.
𝗠𝗲𝘁𝗵𝗼𝗱𝗧𝗶𝗺𝗲𝗿 is a library that measures performance using the [𝗧𝗶𝗺𝗲] 𝗮𝘁𝘁𝗿𝗶𝗯𝘂𝘁𝗲.
It logs performance metrics to the debug output automatically.
The [𝗧𝗶𝗺𝗲] attribute adds 𝗦𝘁𝗼𝗽𝘄𝗮𝘁𝗰𝗵 and 𝗧𝗿𝗮𝗰𝗲.𝗪𝗿𝗶𝘁𝗲𝗟𝗶𝗻𝗲 around methods at compile time.
To customize behavior, define a static class 𝗠𝗲𝘁𝗵𝗼𝗱𝗧𝗶𝗺𝗲𝗟𝗼𝗴𝗴𝗲𝗿 with a Log method.
It supports elapsed time as long or TimeSpan value.
In this method, you can implement your own logging approach.
You can even include parameter values in logs using string formatting in the attribute definition.
Comments