-
Notifications
You must be signed in to change notification settings - Fork 1
Logging
Darren Neimke edited this page Oct 27, 2017
·
1 revision
code-timer emits logging messages whenever there is a call to Complete. As shown in the code snippet, it first checks to see if there is an ILogger instance, and then logs either an Information or a Warning log message based on whether the ExpectedMilliseconds ceiling was exceeded.
if(logger != null) {
var logMessage = this.GetFormattedResult();
if(this.Success()) {
logger.LogInformation(logMessage);
}else{
logger.LogWarning(logMessage);
}
}There are 2 standard formats that are provided via the Verbose property of the CodeTimer. The following 2 examples demonstrate the difference between Verbose and Non-Verbose formatted log messages.
Verbose:
Case1 timer failed. Ran for 1200ms, expected 1000ms.
- Start: 400ms
- Middle: 800ms
- End: 1200ms
Non-Verbose:
Case1,1200,failed,400,800,1200