Skip to content

Commit

Permalink
Update debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
loafoe committed Feb 22, 2023
1 parent 33c6291 commit 6faba8f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/loafoe/go-rabbitmq v0.5.0
github.com/opentracing/opentracing-go v1.2.0
github.com/openzipkin/zipkin-go v0.4.1
github.com/philips-software/go-hsdp-api v0.78.7
github.com/philips-software/go-hsdp-api v0.79.1
github.com/prometheus/client_golang v1.14.0
github.com/sirupsen/logrus v1.9.0
github.com/spf13/viper v1.15.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAy
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU=
github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek=
github.com/philips-software/go-hsdp-api v0.78.7 h1:NyGvZ0TSrTfVEYwA6ZdDpWghoBjGuHR5uhcZqYucVRE=
github.com/philips-software/go-hsdp-api v0.78.7/go.mod h1:J9j11CrQR7OXcvsSo+/kE20mkKpAuqB1dxVnXQETsf4=
github.com/philips-software/go-hsdp-api v0.79.1 h1:QWEacZduULKNwnaDjPS5YF6wtsJY1Gc53KSVsCP+6LQ=
github.com/philips-software/go-hsdp-api v0.79.1/go.mod h1:EDcD+0PXtJjBICd9S4fntNZhqDjSkINlQ3sEMQvDybI=
github.com/philips-software/go-hsdp-signer v1.4.0 h1:yg7UILhmI4xJhr/tQiAiQwJL0EZFvLuMqpH2GZ9ygY4=
github.com/philips-software/go-hsdp-signer v1.4.0/go.mod h1:/QehZ/+Aks2t1TFpjhF/7ZSB8PJIIJHzLc03rOqwLw0=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down
21 changes: 11 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,15 @@ func realMain(echoChan chan<- *echo.Echo) int {
deliveryType := viper.GetString("delivery")
token := os.Getenv("TOKEN")
enableDebug := os.Getenv("DEBUG") == "true"
debugLog := os.Getenv("DEBUG_LOG")
if enableDebug && debugLog == "" {
debugLog = "/dev/stderr"
}
transportURL := viper.GetString("transport_url")

logger.Infof("logproxy %s booting", buildVersion)
if !enableIronIO && !enableSyslog {
logger.Errorf("both syslog and ironio drains are disabled")
return 1
}
if debugLog != "" {
logger.Infof("logging to %s", debugLog)
if enableDebug {
logger.Infof("debug logging is enabled")
}

metrics := metrics{
Expand Down Expand Up @@ -233,14 +229,20 @@ func realMain(echoChan chan<- *echo.Echo) int {
Region: viper.GetString("region"),
Environment: viper.GetString("env"),
}
if enableDebug {
config.DebugLog = os.Stderr
}
serviceID := viper.GetString("service_id")
servicePrivateKey := viper.GetString("service_private_key")
if serviceID != "" && servicePrivateKey != "" {
iamClient, err := iam.NewClient(nil, &iam.Config{
cfg := &iam.Config{
Region: viper.GetString("region"),
Environment: viper.GetString("env"),
DebugLog: debugLog,
})
}
if enableDebug {
cfg.DebugLog = os.Stderr
}
iamClient, err := iam.NewClient(nil, cfg)
if err != nil {
logger.Errorf("failed to create IAM client: %v", err)
return 6
Expand All @@ -257,7 +259,6 @@ func realMain(echoChan chan<- *echo.Echo) int {
config.SharedKey = ""
config.SharedSecret = ""
}
config.DebugLog = debugLog

doneWorker := make(chan bool)
switch deliveryType {
Expand Down

0 comments on commit 6faba8f

Please sign in to comment.