Skip to content

Add db connection debugging logging env#122

Merged
zhouzhuojie merged 1 commit into
masterfrom
zz/add-db-debugging-env
May 10, 2018
Merged

Add db connection debugging logging env#122
zhouzhuojie merged 1 commit into
masterfrom
zz/add-db-debugging-env

Conversation

@zhouzhuojie
Copy link
Copy Markdown
Collaborator

Since the database connection error may contain credentials, we are adding this env to control whether we should log that error or not.

@zhouzhuojie zhouzhuojie requested a review from a team May 10, 2018 00:07
Comment thread pkg/repo/db.go
if err != nil {
if err != nil && config.Config.DBConnectionDebug {
logrus.WithField("err", err).Fatal("failed to connect to db")
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that you want config.Config.DBConnectionDebug to gate the output of err field, instead of the whole log message.

Is the change below what you intended to make?

if err != nil {
  if config.Config.DBConnectionDebug {
    logrus.WithField("err", err).Fatal("failed to connect to db")
  } else {
    logrus.Fatal("failed to connect to db")
  }
}

@zhouzhuojie zhouzhuojie force-pushed the zz/add-db-debugging-env branch from 4236ae4 to 83cd09a Compare May 10, 2018 16:47
@zhouzhuojie zhouzhuojie merged commit ce8becb into master May 10, 2018
@zhouzhuojie zhouzhuojie deleted the zz/add-db-debugging-env branch May 10, 2018 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants