diff --git a/cmd/common-main.go b/cmd/common-main.go index 2d2e9e248..15545471b 100644 --- a/cmd/common-main.go +++ b/cmd/common-main.go @@ -17,7 +17,9 @@ package cmd import ( + "context" "crypto/x509" + "encoding/gob" "errors" "net" "path/filepath" @@ -34,6 +36,17 @@ import ( "github.com/minio/minio/pkg/env" ) +func init() { + logger.Init(GOPATH, GOROOT) + logger.RegisterError(config.FmtError) + + // Initialize globalConsoleSys system + globalConsoleSys = NewConsoleLogger(context.Background()) + logger.AddTarget(globalConsoleSys) + + gob.Register(StorageErr("")) +} + func verifyObjectLayerFeatures(name string, objAPI ObjectLayer) { if (globalAutoEncryption || GlobalKMS != nil) && !objAPI.IsEncryptionSupported() { logger.Fatal(errInvalidArgument, diff --git a/cmd/gateway-main.go b/cmd/gateway-main.go index 972747907..63744d38c 100644 --- a/cmd/gateway-main.go +++ b/cmd/gateway-main.go @@ -35,15 +35,6 @@ import ( "github.com/minio/minio/pkg/env" ) -func init() { - logger.Init(GOPATH, GOROOT) - logger.RegisterError(config.FmtError) - - // Initialize globalConsoleSys system - globalConsoleSys = NewConsoleLogger(context.Background()) - logger.AddTarget(globalConsoleSys) -} - var ( gatewayCmd = cli.Command{ Name: "gateway", diff --git a/cmd/server-main.go b/cmd/server-main.go index 62a8995b7..b88371d29 100644 --- a/cmd/server-main.go +++ b/cmd/server-main.go @@ -18,7 +18,6 @@ package cmd import ( "context" - "encoding/gob" "errors" "fmt" "net/http" @@ -37,17 +36,6 @@ import ( "github.com/minio/minio/pkg/env" ) -func init() { - logger.Init(GOPATH, GOROOT) - logger.RegisterError(config.FmtError) - - // Initialize globalConsoleSys system - globalConsoleSys = NewConsoleLogger(context.Background()) - logger.AddTarget(globalConsoleSys) - - gob.Register(StorageErr("")) -} - // ServerFlags - server command specific flags var ServerFlags = []cli.Flag{ cli.StringFlag{