package main import ( "os" "os/signal" "syscall" "git.loafle.net/commons_go/logging" "git.loafle.net/overflow/probe-consumer-metric/consumer" ) func init() { logging.InitializeLogger("") } func main() { defer logging.Logger().Sync() var c consumer.Consumer go func() { c = consumer.New() if err := c.Start(); err != nil { logging.Logger().Error(err) os.Exit(1) } }() // // Set up channel on which to send signal notifications. // // We must use a buffered channel or risk missing the signal // // if we're not ready to receive when the signal is sent. interrupt := make(chan os.Signal, 1) signal.Notify(interrupt, syscall.SIGKILL, syscall.SIGSTOP, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT) <-interrupt if err := c.Stop(); err != nil { logging.Logger().Errorf("Consumer error: %v", err) } }