natefinch / lumberjack

lumberjack is a log rolling package for Go
MIT License
4.76k stars 585 forks source link

Whether should create a 'NewLogger' function for lumberjack #157

Closed Icarus9913 closed 2 years ago

Icarus9913 commented 2 years ago

@natefinch Hi, I met one issue when I create a func NewLogger() lumberjack.Logger in my project with go vet. This function will return a new copy for 'lumberjsck.Logger', but there's a private property 'sync.mutex'. In this situation, the golang vet tool will catch one error that we can not return copies lock value.

Error: pkg/logutils/log.go:217:9: return copies lock value: gopkg.in/natefinch/lumberjack.v2.Logger contains sync.Mutex How do you think about this situation?