Improved logging on startup

This commit is contained in:
Juan Font Alonso 2022-03-06 16:54:19 +01:00
parent 70910c4595
commit dc909ba6d7

View File

@ -1,7 +1,7 @@
package cli package cli
import ( import (
"log" "github.com/rs/zerolog/log"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -19,12 +19,12 @@ var serveCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
h, err := getHeadscaleApp() h, err := getHeadscaleApp()
if err != nil { if err != nil {
log.Fatalf("Error initializing: %s", err) log.Fatal().Caller().Err(err).Msg("Error initializing")
} }
err = h.Serve() err = h.Serve()
if err != nil { if err != nil {
log.Fatalf("Error initializing: %s", err) log.Fatal().Caller().Err(err).Msg("Error starting server")
} }
}, },
} }