Skip to content

Commit

Permalink
fix(boot.go): use standard log package for startup
Browse files Browse the repository at this point in the history
Builder seems to not print proper log messages with the
github.com/pkg/log package, but only on startup. This fixes that issue.
  • Loading branch information
Aaron Schlesinger committed Feb 12, 2016
1 parent 5081ba5 commit 5a209b6
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions boot.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"log"
"os"
"runtime"

Expand Down Expand Up @@ -49,34 +50,34 @@ func main() {

s3Client, err := storage.GetClient(cnf.HealthSrvTestStorageRegion)
if err != nil {
pkglog.Err("getting s3 client [%s]", err)
log.Printf("Error getting s3 client (%s)", err)
os.Exit(1)
}
kubeClient, err := kcl.NewInCluster()
if err != nil {
pkglog.Err("getting kubernetes client [%s]", err)
log.Printf("Error getting kubernetes client [%s]", err)
os.Exit(1)
}
pkglog.Info("starting health check server on port %d", cnf.HealthSrvPort)
log.Printf("Starting health check server on port %d", cnf.HealthSrvPort)
healthSrvCh := make(chan error)
go func() {
if err := healthsrv.Start(cnf.HealthSrvPort, kubeClient.Namespaces(), s3Client, circ); err != nil {
healthSrvCh <- err
}
}()

pkglog.Info("starting SSH server on %s:%d", cnf.SSHHostIP, cnf.SSHHostPort)
log.Printf("Starting SSH server on %s:%d", cnf.SSHHostIP, cnf.SSHHostPort)
sshCh := make(chan int)
go func() {
sshCh <- pkg.RunBuilder(cnf.SSHHostIP, cnf.SSHHostPort, circ)
}()

select {
case err := <-healthSrvCh:
pkglog.Err("Error running health server (%s)", err)
log.Printf("Error running health server (%s)", err)
os.Exit(1)
case i := <-sshCh:
pkglog.Err("Unexpected SSH server stop with code %d", i)
log.Printf("Unexpected SSH server stop with code %d", i)
os.Exit(i)
}
},
Expand All @@ -88,13 +89,13 @@ func main() {
Action: func(c *cli.Context) {
cnf := new(gitreceive.Config)
if err := conf.EnvConfig(gitReceiveConfAppName, cnf); err != nil {
pkglog.Err("Error getting config for %s [%s]", gitReceiveConfAppName, err)
log.Printf("Error getting config for %s [%s]", gitReceiveConfAppName, err)
os.Exit(1)
}
cnf.CheckDurations()

if err := gitreceive.Run(cnf); err != nil {
pkglog.Err("running git receive hook [%s]", err)
log.Printf("Error running git receive hook [%s]", err)
os.Exit(1)
}
},
Expand Down

2 comments on commit 5a209b6

@bacongobbler
Copy link

Choose a reason for hiding this comment

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

Would you mind posting an issue on deis/pkg about this bug? Interested to see what's causing this

@arschles
Copy link
Owner

Choose a reason for hiding this comment

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

Filed deis/pkg#19 to track this issue

Please sign in to comment.