mirror of
https://github.com/minio/minio.git
synced 2025-03-03 15:20:08 -05:00
log: Enable loggers just after configuration load (#3348)
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.
This commit is contained in:
parent
752ed7915b
commit
fd1f09a66c
10
cmd/main.go
10
cmd/main.go
@ -167,11 +167,16 @@ func Main() {
|
|||||||
|
|
||||||
// Initialize config.
|
// Initialize config.
|
||||||
configCreated, err := initConfig()
|
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 {
|
if configCreated {
|
||||||
console.Println("Created minio configuration file at " + mustGetConfigPath())
|
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.
|
// Fetch access keys from environment variables and update the config.
|
||||||
accessKey := os.Getenv("MINIO_ACCESS_KEY")
|
accessKey := os.Getenv("MINIO_ACCESS_KEY")
|
||||||
secretKey := os.Getenv("MINIO_SECRET_KEY")
|
secretKey := os.Getenv("MINIO_SECRET_KEY")
|
||||||
@ -189,9 +194,6 @@ func Main() {
|
|||||||
fatalIf(errInvalidArgument, "Invalid secret key. Accept only a string containing from 8 to 40 characters.")
|
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.
|
// Init the error tracing module.
|
||||||
initError()
|
initError()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user