logging/record.go

25 lines
467 B
Go
Raw Permalink Normal View History

2013-06-21 18:35:47 +02:00
package logging
import (
"time"
)
2020-02-01 17:30:09 +01:00
// Record contains the data to be logged. It is passed to a formatter to
// generate the logged message.
2013-06-21 18:35:47 +02:00
type Record struct {
Logger string
2013-06-21 18:35:47 +02:00
Timestamp time.Time
Level Level
Message string
}
// NewRecord creates a new record, setting its timestamp to time.Now().
func NewRecord(name string, l Level, m string) *Record {
return &Record{
Logger: name,
2013-06-21 18:35:47 +02:00
Level: l,
Message: m,
Timestamp: time.Now(),
}
}