X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Flog.go;h=5e53bcbd0c3a08dacae28a2959e27957ba7d1ea0;hb=cf9363f956cb2d93a581c11ed65c5b02910d10d5;hp=97a8a8fd793ef08d7777dd18813ad4022eb730bd;hpb=887ea7ab9d0d957cd0b4566c28985c7d84a5832f;p=nncp.git diff --git a/src/log.go b/src/log.go index 97a8a8f..5e53bcb 100644 --- a/src/log.go +++ b/src/log.go @@ -1,6 +1,6 @@ /* NNCP -- Node to Node copy, utilities for store-and-forward data exchange -Copyright (C) 2016-2021 Sergey Matveev +Copyright (C) 2016-2023 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -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)) }