// setLogEntry populates the log entry with format, arguments, // and any available fields set in the context. func setLogEntry(ctx context.Context, format string, args []interface{}, entry *proto.LogEntry) { entry.Format, entry.Args = parseFormatWithArgs(format, args) if ctx != nil { for i := Field(0); i < maxField; i++ { if v := ctx.Value(i); v != nil { switch vTyp := v.(type) { case proto.NodeID: entry.NodeID = &vTyp case proto.StoreID: entry.StoreID = &vTyp case proto.RaftID: entry.RaftID = &vTyp case proto.Method: entry.Method = &vTyp case proto.Key: entry.Key = vTyp } } } } }