-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(log-level-config): exact duration match should return the correct level #17
base: master
Are you sure you want to change the base?
Conversation
@holtkamp would you mind taking a look at this? |
On vacation now, so might take some time before I have time to have a good look... |
@holtkamp thanks, enjoy your time off! : ) |
@@ -65,6 +65,11 @@ private function determineApplicableLogLevel(float $durationInSeconds) : ?string | |||
//Acquire a common / non-associative array with all the thresholds | |||
$durationThresholds = array_values($this->logLevelMapping); | |||
|
|||
$exactDurationMatch = array_search($durationInMilliseconds, $this->logLevelMapping); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- this can/should be done "as early as possible" in the function?
- What is the chance that a duration (float) is exactly matched in a real-world situation? I think that chance is near 0... So what justifies this check? Being able to test it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- What is the chance that a duration (float) is exactly matched in a real-world situation? I think that chance is near 0... So what justifies this check? Being able to test it?
i agree that it is near 0. i wouldn't say that the justification is testability, rather accuracy. i tested an edge and the value i expected to get was the not the actual value.
- this can/should be done "as early as possible" in the function?
i think you're correct in assuming the chances are near 0. would this be more palatable at the very end of the function? before null is returned?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mention two very valid points 😉. Indeed, moving the "exact match" scenario to the end seems a good place for such edge case 👍
No description provided.