func (s *RecordSuite) TestValidateZero(c *gc.C) { var rec logfwd.Record err := rec.Validate() c.Check(err, jc.Satisfies, errors.IsNotValid) }
func recordFromAPI(apiRec params.LogStreamRecord, controllerUUID string) (logfwd.Record, error) { rec := logfwd.Record{ ID: apiRec.ID, Timestamp: apiRec.Timestamp, Message: apiRec.Message, } origin, err := originFromAPI(apiRec, controllerUUID) if err != nil { return rec, errors.Trace(err) } rec.Origin = origin loc, err := logfwd.ParseLocation(apiRec.Module, apiRec.Location) if err != nil { return rec, errors.Trace(err) } rec.Location = loc level, ok := loggo.ParseLevel(apiRec.Level) if !ok { return rec, errors.Errorf("unrecognized log level %q", apiRec.Level) } rec.Level = level if err := rec.Validate(); err != nil { return rec, errors.Trace(err) } return rec, nil }