File tree Expand file tree Collapse file tree 3 files changed +7
-12
lines changed Expand file tree Collapse file tree 3 files changed +7
-12
lines changed Original file line number Diff line number Diff line change 11## log
2- <img align =" right " src =" https://raw.githubusercontent.com/go-playground/log/master/logo.png " >![ Project status] ( https://img.shields.io/badge/version-5.0.1 -green.svg )
2+ <img align =" right " src =" https://raw.githubusercontent.com/go-playground/log/master/logo.png " >![ Project status] ( https://img.shields.io/badge/version-5.0.2 -green.svg )
33[ ![ Build Status] ( https://semaphoreci.com/api/v1/joeybloggs/log/branches/master/badge.svg )] ( https://semaphoreci.com/joeybloggs/log )
44[ ![ Coverage Status] ( https://coveralls.io/repos/github/go-playground/log/badge.svg?branch=master )] ( https://coveralls.io/github/go-playground/log?branch=master )
55[ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/go-playground/log )] ( https://goreportcard.com/report/github.com/go-playground/log )
Original file line number Diff line number Diff line change @@ -21,21 +21,14 @@ type Entry struct {
2121}
2222
2323func newEntry (e Entry ) Entry {
24- ne := Entry {
25- Fields : make ([]Field , 0 , len (e .Fields )),
26- Timestamp : time .Now (),
27- Message : e .Message ,
28- Level : e .Level ,
29- start : e .start ,
30- }
31- ne .Fields = append (ne .Fields , e .Fields ... )
32- return ne
24+ flds := make ([]Field , 0 , len (e .Fields ))
25+ e .Fields = append (flds , e .Fields ... )
26+ return e
3327}
3428
3529func newEntryWithFields (fields []Field ) Entry {
3630 e := Entry {
37- Fields : make ([]Field , 0 , len (fields )),
38- Timestamp : time .Now (),
31+ Fields : make ([]Field , 0 , len (fields )),
3932 }
4033 e .Fields = append (e .Fields , fields ... )
4134 return e
Original file line number Diff line number Diff line change @@ -56,6 +56,8 @@ func handleEntry(e Entry) {
5656 if ! e .start .IsZero () {
5757 e = e .WithField ("duration" , time .Since (e .start ))
5858 }
59+ e .Timestamp = time .Now ()
60+
5961 for _ , h := range logHandlers [e .Level ] {
6062 h .Log (e )
6163 }
You can’t perform that action at this time.
0 commit comments