Skip to content

how to get Event timestamp in hook Run() ? #679

Open
@zhujintao

Description

@zhujintao

suggestion is to use the function in the file event.go

func (e *Event) Timestamp() *Event {
	if e == nil {
		return e
	}
	t := TimestampFunc()
	ctx := context.WithValue(e.GetCtx(), "time", t)
	e.Ctx(ctx)
	e.buf = enc.AppendTime(enc.AppendKey(e.buf, TimestampFieldName), t, TimeFieldFormat)
	return e
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions