]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/log.go
Print debug raw records
[nncp.git] / 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))
        }