logging/record.go

26 lines
474 B
Go
Raw 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
}
2020-02-01 17:30:09 +01:00
// NewRecord creates a new record, setting its timestamp to time.Now()
func NewRecord(name string, l Level, m string) (r *Record) {
2013-06-21 18:35:47 +02:00
r = &Record{
Logger: name,
2013-06-21 18:35:47 +02:00
Level: l,
Message: m,
Timestamp: time.Now(),
}
return
}