From d7a2ae8e13f2d830688091c072878c145ac07f17 Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Tue, 25 Mar 2014 18:19:35 -0700 Subject: [PATCH] beam/examples/beamsh: prettier 'trace' command Docker-DCO-1.1-Signed-off-by: Solomon Hykes (github: shykes) --- pkg/beam/examples/beamsh/beamsh.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkg/beam/examples/beamsh/beamsh.go b/pkg/beam/examples/beamsh/beamsh.go index d4f9ac877..789614709 100644 --- a/pkg/beam/examples/beamsh/beamsh.go +++ b/pkg/beam/examples/beamsh/beamsh.go @@ -191,11 +191,16 @@ func GetHandler(name string) Handler { if err != nil { return } - fd := -1 - if a != nil { - fd = int(a.Fd()) + var msg string + if pretty := data.Message(string(p)).Pretty(); pretty != "" { + msg = pretty + } else { + msg = string(p) } - fmt.Printf("===> [TRACE] %s [%d]\n", p, fd) + if a != nil { + msg = fmt.Sprintf("%s [%d]", msg, a.Fd()) + } + fmt.Printf("===> %s\n", msg) beam.Send(out, p, a) } }