Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao committed Mar 16, 2023
1 parent 5a7442f commit 92baffd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions log.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package log

import (
"errors"
"fmt"
"os"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -153,7 +154,7 @@ func (s *lockWithTimeoutWrapper) unlock() {
func (s *lockWithTimeoutWrapper) Write(bs []byte) (int, error) {
succ := s.getLockOrBlock()
if !succ {
panic("write log hang")
panic(fmt.Sprintf("Timeout of %ds when trying to write log", s.timeout))
}
defer s.unlock()

Expand All @@ -163,7 +164,7 @@ func (s *lockWithTimeoutWrapper) Write(bs []byte) (int, error) {
func (s *lockWithTimeoutWrapper) Sync() error {
succ := s.getLockOrBlock()
if !succ {
panic("sync log hang")
panic(fmt.Sprintf("Timeout of %ds when trying to sync log", s.timeout))
}
defer s.unlock()

Expand Down

0 comments on commit 92baffd

Please sign in to comment.