summaryrefslogtreecommitdiffstats
path: root/pkg/app
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2018-08-28 18:01:53 +1000
committerJesse Duffield <jessedduffield@gmail.com>2018-08-28 18:01:53 +1000
commit320ccdb22afc89e7bd77695eafb262281b323095 (patch)
tree5069a2dbed12ab56b2ec2f479314ed5db17a9d7f /pkg/app
parentdb1d5328f2895fb3437f2ef70f4c2ef54adf2ee3 (diff)
when panicking due to malformed gitconfig, show a more useful error
Diffstat (limited to 'pkg/app')
-rw-r--r--pkg/app/app.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/pkg/app/app.go b/pkg/app/app.go
index 0b163f553..ffd8807f0 100644
--- a/pkg/app/app.go
+++ b/pkg/app/app.go
@@ -30,11 +30,6 @@ type App struct {
func newProductionLogger(config config.AppConfigurer) *logrus.Logger {
log := logrus.New()
log.Out = ioutil.Discard
- if config.GetUserConfig().GetString("reporting") == "on" {
- // this isn't really a secret token: it only has permission to push new rollbar items
- hook := rollrus.NewHook("23432119147a4367abf7c0de2aa99a2d", "production")
- log.Hooks.Add(hook)
- }
return log
}
@@ -50,11 +45,18 @@ func newDevelopmentLogger() *logrus.Logger {
func newLogger(config config.AppConfigurer) *logrus.Entry {
var log *logrus.Logger
+ environment := "production"
if config.GetDebug() {
+ environment = "development"
log = newDevelopmentLogger()
} else {
log = newProductionLogger(config)
}
+ if config.GetUserConfig().GetString("reporting") == "on" {
+ // this isn't really a secret token: it only has permission to push new rollbar items
+ hook := rollrus.NewHook("23432119147a4367abf7c0de2aa99a2d", environment)
+ log.Hooks.Add(hook)
+ }
return log.WithFields(logrus.Fields{
"debug": config.GetDebug(),
"version": config.GetVersion(),
@@ -75,7 +77,7 @@ func NewApp(config config.AppConfigurer) (*App, error) {
app.Tr = i18n.NewLocalizer(app.Log)
- app.GitCommand, err = commands.NewGitCommand(app.Log, app.OSCommand)
+ app.GitCommand, err = commands.NewGitCommand(app.Log, app.OSCommand, app.Tr)
if err != nil {
return app, err
}