Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
Handle the IsZero timestamp case
Browse files Browse the repository at this point in the history
  • Loading branch information
bhs committed Sep 19, 2016
1 parent 508626b commit 6094834
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion span.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,14 @@ type LogData struct {

// ToLogRecord converts a deprecated LogData to a non-deprecated LogRecord
func (ld *LogData) ToLogRecord() LogRecord {
var literalTimestamp time.Time
if ld.Timestamp.IsZero() {
literalTimestamp = time.Now()
} else {
literalTimestamp = ld.Timestamp
}
rval := LogRecord{
Timestamp: ld.Timestamp,
Timestamp: literalTimestamp,
}
if ld.Payload == nil {
rval.Fields = []log.Field{
Expand Down

0 comments on commit 6094834

Please sign in to comment.