Permalink
Browse files

Handle the IsZero timestamp case

  • Loading branch information...
1 parent ea0e301 commit d3768c5f5693fd5ea0ec1aa58c897d86c3a89995 @bensigelman bensigelman committed Sep 19, 2016
Showing with 7 additions and 1 deletion.
  1. +7 −1 span.go
View
@@ -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{

0 comments on commit d3768c5

Please sign in to comment.