Skip to content

Commit

Permalink
Disable stack trace on error
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Weiße <[email protected]>
  • Loading branch information
daniel-weisse committed Jan 27, 2023
1 parent b8b7a19 commit b877184
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cmd/coordinator/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package main

import (
"fmt"
"os"
"strings"

Expand Down Expand Up @@ -35,16 +36,17 @@ func run(validator quote.Validator, issuer quote.Issuer, sealDir string, sealer
devMode := util.Getenv(constants.DevMode, constants.DevModeDefault) == "1"

// Setup logging with Zap Logger
// Development Logger shows a stacktrace for warnings & errors, Production Logger only for errors
var log *zap.Logger
var err error
var cfg zap.Config
if devMode {
log, err = zap.NewDevelopment()
cfg = zap.NewDevelopmentConfig()
} else {
log, err = zap.NewProduction()
cfg = zap.NewProductionConfig()
cfg.DisableStacktrace = true // Disable stacktraces in production
}
log, err := cfg.Build()
if err != nil {
panic(err)
fmt.Fprintf(os.Stderr, "failed to create logger: %s\n", err)
os.Exit(1)
}
defer log.Sync() // flushes buffer, if any

Expand Down

0 comments on commit b877184

Please sign in to comment.