mirror of
https://github.com/minio/minio.git
synced 2025-11-06 20:33:07 -05:00
Probe revamped to provide for a new WrappedError struct to wrap probes as error interface
This convenience was necessary to be used for golang library functions like io.Copy and io.Pipe where we shouldn't be writing proxies and alternatives returning *probe.Error This change also brings more changes across code base for clear separation regarding where an error interface should be passed encapsulating *probe.Error and where it should be used as is.
This commit is contained in:
@@ -24,7 +24,6 @@ import (
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/minio/minio/pkg/probe"
|
||||
"github.com/minio/minio/pkg/utils/log"
|
||||
)
|
||||
|
||||
@@ -99,12 +98,12 @@ func fileLogger(filename string) (chan<- []byte, error) {
|
||||
ch := make(chan []byte)
|
||||
file, err := os.OpenFile(filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
|
||||
if err != nil {
|
||||
return nil, probe.New(err)
|
||||
return nil, err
|
||||
}
|
||||
go func() {
|
||||
for message := range ch {
|
||||
if _, err := io.Copy(file, bytes.NewBuffer(message)); err != nil {
|
||||
log.Errorln(probe.New(err))
|
||||
log.Errorln(err)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user