feat(*): Update DisposableStopWatch to work without a logger

This commit is contained in:
Josh Creek
2021-12-14 22:52:16 +00:00
parent d8ab65334a
commit 4b8acdf4d9
3 changed files with 34 additions and 4 deletions
+9
View File
@@ -157,4 +157,13 @@ using (_logger.DisposableStopWatch("A message", true))
}
```
You can also make use of it without a logger for very barebones console applications.
```csharp
using ("A message".DisposableStopWatch())
{
...
}
```
You get a `Start:` log, with the message appended if you've passed it, and once your code within the using block has run you get `Complete:` with the messaged appended if you've passed it, then on the same line `Elapsed:` and the time elapsed in HH:MM:SS:MS..... format.