Skip to content

Commit

Permalink
clean up skipDepth
Browse files Browse the repository at this point in the history
  • Loading branch information
Keloran committed Dec 5, 2022
1 parent 7b5efc6 commit a8214bb
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions logs/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import (
)

const (
skipDepthLocal = 4
skipDepthGeneral = 3
skipDepth = 3
)

func (b BugFixes) Unwrap(e error) error {
Expand Down Expand Up @@ -149,19 +148,15 @@ func (b *BugFixes) skipDepth(depth int) {
}

func (b BugFixes) DoReporting() {
b.skipDepth(skipDepthGeneral)
if b.LocalOnly {
b.skipDepth(skipDepthLocal)

if b.SkipDepthOverride != 0 {
b.skipDepth(b.SkipDepthOverride)
}
b.skipDepth(skipDepth)
if b.SkipDepthOverride != 0 {
b.skipDepth(b.SkipDepthOverride)
}

skipDepth := skipDepthLocal
skipDepthOverride := skipDepth
for {
if notDeepEnough := strings.Contains(b.File, "logs.go"); notDeepEnough {
b.skipDepth(skipDepth + 1)
b.skipDepth(skipDepthOverride + 1)
} else {
break
}
Expand Down

0 comments on commit a8214bb

Please sign in to comment.