Skip to content

Commit ac1e620

Browse files
committed
fixed: business
1 parent 6b4c0be commit ac1e620

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

rotatelogs.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,10 @@ func (rl *RotateLogs) Write(bytes []byte) (n int, err error) {
145145
func (rl *RotateLogs) getWriterNolock(bailOnRotateFail, useGenerationalNames bool, business string) (io.Writer, error) {
146146
if business != "" {
147147
slice := strings.Split(rl.pattern.Pattern(), "/")
148-
slice = append(slice[:len(slice)-1], business, slice[len(slice)-1])
149-
rl.pattern, _ = strftime.New(strings.Join(slice, "/"))
148+
if slice[len(slice)-2] != business {
149+
slice = append(slice[:len(slice)-1], business, slice[len(slice)-1])
150+
rl.pattern, _ = strftime.New(strings.Join(slice, "/"))
151+
}
150152
}
151153
generation := rl.generation
152154
previousFn := rl.curFn

0 commit comments

Comments
 (0)