]> Cypherpunks.ru repositories - nncp.git/commitdiff
Print debug raw records
authorSergey Matveev <stargrave@stargrave.org>
Sun, 10 Oct 2021 11:52:50 +0000 (14:52 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 10 Oct 2021 11:52:50 +0000 (14:52 +0300)
src/log.go

index 97a8a8fd793ef08d7777dd18813ad4022eb730bd..e4b860f9e5061a7c7accd23b7341e66050c611b7 100644 (file)
@@ -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))
        }