From 9602c569ec7ceddf171b2411a1d6941affae19bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulo=20Sima=CC=83o?= Date: Thu, 14 Oct 2021 06:24:39 -0300 Subject: [PATCH] transform log in writer --- types/lib.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/lib.go b/types/lib.go index dc5d48b..b3d665b 100644 --- a/types/lib.go +++ b/types/lib.go @@ -212,6 +212,11 @@ type Log struct { History string `json:"history,omitempty"` } +func (l *Log) Write(p []byte) (n int, err error) { + l.AddHistory(string(p)) + return len(p), nil +} + func (l *Log) AddHistory(s string) { s = fmt.Sprintf("* %s: %s", time.Now().Format("02/01/06 - 15:04:05"), s) if l.History == "" {