service.go 808 B

123456789101112131415161718192021222324252627282930313233
  1. package dataflow
  2. import (
  3. "context"
  4. "strconv"
  5. "time"
  6. "go-common/app/interface/main/app-interface/conf"
  7. "go-common/library/log"
  8. "go-common/library/log/infoc"
  9. )
  10. // Service is search service
  11. type Service struct {
  12. c *conf.Config
  13. infoc *infoc.Infoc
  14. }
  15. // New is search service initial func
  16. func New(c *conf.Config) (s *Service) {
  17. s = &Service{
  18. c: c,
  19. infoc: infoc.New(c.Infoc),
  20. }
  21. return
  22. }
  23. func (s *Service) Report(c context.Context, eventID, eventType, buvid, fts, messageInfo string, now time.Time) (err error) {
  24. if err = s.infoc.Info(strconv.FormatInt(now.Unix(), 10), eventID, eventType, buvid, fts, messageInfo); err != nil {
  25. log.Error("s.infoc2.Info(%v,%v,%v,%v,%v,%v) error(%v)", strconv.FormatInt(now.Unix(), 10), eventID, eventType, buvid, fts, messageInfo, err)
  26. }
  27. return
  28. }