Skip to content

Commit

Permalink
log: Enable loggers just after configuration load (minio#3348)
Browse files Browse the repository at this point in the history
It would make sense to enable logger just after config initialisation.
That way, errorIf() and fatalIf() will be usable and can catch error
like invalid access and key errors.
  • Loading branch information
vadmeste authored and harshavardhana committed Nov 25, 2016
1 parent 752ed79 commit fd1f09a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,16 @@ func Main() {

// Initialize config.
configCreated, err := initConfig()
fatalIf(err, "Unable to initialize minio config.")
if err != nil {
console.Fatalf("Unable to initialize minio config. Err: %s.\n", err)
}
if configCreated {
console.Println("Created minio configuration file at " + mustGetConfigPath())
}

// Enable all loggers by now so we can use errorIf() and fatalIf()
enableLoggers()

// Fetch access keys from environment variables and update the config.
accessKey := os.Getenv("MINIO_ACCESS_KEY")
secretKey := os.Getenv("MINIO_SECRET_KEY")
Expand All @@ -189,9 +194,6 @@ func Main() {
fatalIf(errInvalidArgument, "Invalid secret key. Accept only a string containing from 8 to 40 characters.")
}

// Enable all loggers by now.
enableLoggers()

// Init the error tracing module.
initError()

Expand Down

0 comments on commit fd1f09a

Please sign in to comment.