transform log in writer
parent
a6a48c459b
commit
9602c569ec
|
@ -212,6 +212,11 @@ type Log struct {
|
||||||
History string `json:"history,omitempty"`
|
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) {
|
func (l *Log) AddHistory(s string) {
|
||||||
s = fmt.Sprintf("* %s: %s", time.Now().Format("02/01/06 - 15:04:05"), s)
|
s = fmt.Sprintf("* %s: %s", time.Now().Format("02/01/06 - 15:04:05"), s)
|
||||||
if l.History == "" {
|
if l.History == "" {
|
||||||
|
|
Loading…
Reference in New Issue