noop.go 852 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package trace
  2. var (
  3. _ Tracer = nooptracer{}
  4. )
  5. type nooptracer struct{}
  6. func (n nooptracer) New(title string, opts ...Option) Trace {
  7. return noopspan{}
  8. }
  9. func (n nooptracer) Inject(t Trace, format interface{}, carrier interface{}) error {
  10. return nil
  11. }
  12. func (n nooptracer) Extract(format interface{}, carrier interface{}) (Trace, error) {
  13. return noopspan{}, nil
  14. }
  15. type noopspan struct{}
  16. func (n noopspan) Fork(string, string) Trace {
  17. return noopspan{}
  18. }
  19. func (n noopspan) Follow(string, string) Trace {
  20. return noopspan{}
  21. }
  22. func (n noopspan) Finish(err *error) {}
  23. func (n noopspan) SetTag(tags ...Tag) Trace {
  24. return noopspan{}
  25. }
  26. func (n noopspan) SetLog(logs ...LogField) Trace {
  27. return noopspan{}
  28. }
  29. func (n noopspan) Visit(func(k, v string)) {}
  30. func (n noopspan) SetTitle(string) {}
  31. func (n noopspan) String() string { return "" }