Skip to content
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

🔨 new logger.FuncDur() #4800

Merged
merged 1 commit into from
Oct 31, 2024
Merged

🔨 new logger.FuncDur() #4800

merged 1 commit into from
Oct 31, 2024

Conversation

afiune
Copy link
Contributor

@afiune afiune commented Oct 31, 2024

FuncDur must be used in a defer statement.

This new helper function receives the function name and the time when the
function started and logs out the time it took to run.

Example:

package mypackage

func MyFunction() {
   defer logger.FuncDur(time.Now(), "mypackage.MyFunction")

   ...
}

`FuncDur` must be used in a `defer` statement.

This new helper function receives the function name and the time
when the function started and logs out the time it took to run.

Example:
```go
package mypackage

func MyFunction() {
   defer logger.FuncDur(time.Now(), "mypackage.MyFunction")

   ...
}
```

Signed-off-by: Salim Afiune Maya <afiune@mondoo.com>
Copy link
Contributor

Test Results

3 116 tests  ±0   3 115 ✅ ±0   1m 24s ⏱️ -22s
  371 suites ±0       1 💤 ±0 
   28 files   ±0       0 ❌ ±0 

Results for commit dfbf117. ± Comparison against base commit 7aa48cc.

Copy link
Member

@chris-rock chris-rock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @afiune

@afiune afiune merged commit 3544698 into main Oct 31, 2024
15 checks passed
@afiune afiune deleted the afiune/253/logger-func-duration branch October 31, 2024 13:07
@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants