From: Sergey Matveev Date: Sun, 10 Oct 2021 11:52:50 +0000 (+0300) Subject: Print debug raw records X-Git-Tag: v8.0.0^2~6 X-Git-Url: http://www.git.cypherpunks.ru/?p=nncp.git;a=commitdiff_plain;h=714b4cd95515dd405f994a77909109b65fc9374f Print debug raw records --- diff --git a/src/log.go b/src/log.go index 97a8a8f..e4b860f 100644 --- a/src/log.go +++ b/src/log.go @@ -134,6 +134,9 @@ func (ctx *Ctx) LogI(who string, les LEs, msg func(LEs) string) { les = append(LEs{{"Who", who}}, les...) les = append(les, LE{"Msg", msg(les)}) rec := les.Rec() + if ctx.Debug { + fmt.Fprint(os.Stderr, rec) + } if !ctx.Quiet { fmt.Fprintln(os.Stderr, ctx.HumanizeRec(rec)) } @@ -144,6 +147,9 @@ func (ctx *Ctx) LogE(who string, les LEs, err error, msg func(LEs) string) { les = append(LEs{{"Err", err.Error()}, {"Who", who}}, les...) les = append(les, LE{"Msg", msg(les)}) rec := les.Rec() + if ctx.Debug { + fmt.Fprint(os.Stderr, rec) + } if !ctx.Quiet { fmt.Fprintln(os.Stderr, ctx.HumanizeRec(rec)) }