From e7030c4bf59e8e148822c50ae1a5896c604c38c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Fri, 3 Mar 2017 11:41:52 +0200 Subject: all: update light logs (and a few others) to the new model --- internal/debug/api.go | 7 +++---- internal/debug/flags.go | 6 ++++-- internal/debug/trace.go | 5 ++--- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'internal/debug') diff --git a/internal/debug/api.go b/internal/debug/api.go index 01126b41b..8b7693f6a 100644 --- a/internal/debug/api.go +++ b/internal/debug/api.go @@ -22,7 +22,6 @@ package debug import ( "errors" - "fmt" "io" "os" "os/user" @@ -111,7 +110,7 @@ func (h *HandlerT) StartCPUProfile(file string) error { } h.cpuW = f h.cpuFile = file - log.Info(fmt.Sprint("CPU profiling started, writing to", h.cpuFile)) + log.Info("CPU profiling started", "dump", h.cpuFile) return nil } @@ -123,7 +122,7 @@ func (h *HandlerT) StopCPUProfile() error { if h.cpuW == nil { return errors.New("CPU profiling not in progress") } - log.Info(fmt.Sprint("done writing CPU profile to", h.cpuFile)) + log.Info("Done writing CPU profile", "dump", h.cpuFile) h.cpuW.Close() h.cpuW = nil h.cpuFile = "" @@ -179,7 +178,7 @@ func (*HandlerT) Stacks() string { func writeProfile(name, file string) error { p := pprof.Lookup(name) - log.Info(fmt.Sprintf("writing %d %s profile records to %s", p.Count(), name, file)) + log.Info("Writing profile records", "count", p.Count(), "type", name, "dump", file) f, err := os.Create(expandHome(file)) if err != nil { return err diff --git a/internal/debug/flags.go b/internal/debug/flags.go index f95251939..6247cc7dc 100644 --- a/internal/debug/flags.go +++ b/internal/debug/flags.go @@ -129,8 +129,10 @@ func Setup(ctx *cli.Context) error { if ctx.GlobalBool(pprofFlag.Name) { address := fmt.Sprintf("%s:%d", ctx.GlobalString(pprofAddrFlag.Name), ctx.GlobalInt(pprofPortFlag.Name)) go func() { - log.Info(fmt.Sprintf("starting pprof server at http://%s/debug/pprof", address)) - log.Error(fmt.Sprint(http.ListenAndServe(address, nil))) + log.Info("Starting pprof server", "addr", fmt.Sprintf("http://%s/debug/pprof", address)) + if err := http.ListenAndServe(address, nil); err != nil { + log.Error("Failure in running pprof server", "err", err) + } }() } return nil diff --git a/internal/debug/trace.go b/internal/debug/trace.go index 5e4b9df84..cab5deaaf 100644 --- a/internal/debug/trace.go +++ b/internal/debug/trace.go @@ -20,7 +20,6 @@ package debug import ( "errors" - "fmt" "os" "runtime/trace" @@ -44,7 +43,7 @@ func (h *HandlerT) StartGoTrace(file string) error { } h.traceW = f h.traceFile = file - log.Info(fmt.Sprint("trace started, writing to", h.traceFile)) + log.Info("Go tracing started", "dump", h.traceFile) return nil } @@ -56,7 +55,7 @@ func (h *HandlerT) StopGoTrace() error { if h.traceW == nil { return errors.New("trace not in progress") } - log.Info(fmt.Sprint("done writing trace to", h.traceFile)) + log.Info("Done writing Go trace", "dump", h.traceFile) h.traceW.Close() h.traceW = nil h.traceFile = "" -- cgit v1.2.3