Create logger package and rename errorIf to LogIf (#5678)

Removing message from error logging
Replace errors.Trace with LogIf
This commit is contained in:
kannappanr
2018-04-05 15:04:40 -07:00
committed by GitHub
parent 91fd8ffeb7
commit f8a3fd0c2a
119 changed files with 2608 additions and 1860 deletions

View File

@@ -17,8 +17,10 @@
package cmd
import (
"context"
"path"
"github.com/minio/minio/cmd/logger"
"github.com/minio/minio/pkg/errors"
)
@@ -34,7 +36,7 @@ func (xl xlObjects) getLoadBalancedDisks() (disks []StorageAPI) {
// This function does the following check, suppose
// object is "a/b/c/d", stat makes sure that objects ""a/b/c""
// "a/b" and "a" do not exist.
func (xl xlObjects) parentDirIsObject(bucket, parent string) bool {
func (xl xlObjects) parentDirIsObject(ctx context.Context, bucket, parent string) bool {
var isParentDirObject func(string) bool
isParentDirObject = func(p string) bool {
if p == "." || p == "/" {
@@ -66,7 +68,11 @@ func (xl xlObjects) isObject(bucket, prefix string) (ok bool) {
if errors.IsErrIgnored(err, xlTreeWalkIgnoredErrs...) {
continue
}
errorIf(err, "Unable to stat a file %s/%s/%s", bucket, prefix, xlMetaJSONFile)
reqInfo := &logger.ReqInfo{BucketName: bucket}
reqInfo.AppendTags("prefix", prefix)
reqInfo.AppendTags("xlMetaJSONFile", xlMetaJSONFile)
ctx := logger.SetReqInfo(context.Background(), reqInfo)
logger.LogIf(ctx, err)
} // Exhausted all disks - return false.
return false
}