logging/record.go

24 lines
467 B
Go

package logging
import (
"time"
)
// Record contains the data to be logged. It is passed to a formatter to
// generate the logged message.
type Record struct {
Logger string
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,
Level: l,
Message: m,
Timestamp: time.Now(),
}
}