Documentation ¶
Index ¶
- type Tracer
- func (t *Tracer) AddJSON(jsonTrace []byte) error
- func (t *Tracer) Done()
- func (t *Tracer) Donef(format string, args ...any)
- func (t *Tracer) Enabled() bool
- func (t *Tracer) NewChild(format string, args ...any) *Tracer
- func (t *Tracer) Printf(format string, args ...any)
- func (t *Tracer) String() string
- func (t *Tracer) ToJSON() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
Tracer represents query tracer.
It must be created via New call. Each created tracer must be finalized via Done or Donef call.
Tracer may contain sub-tracers (branches) in order to build tree-like execution order. Call Tracer.NewChild func for adding sub-tracer.
func New ¶
New creates a new instance of the tracer with the given fmt.Sprintf(format, args...) message.
If enabled isn't set, then all function calls to the returned object will be no-op.
Done or Donef must be called when the tracer should be finished.
func (*Tracer) AddJSON ¶
AddJSON adds a sub-trace to t.
The jsonTrace must be encoded with ToJSON.
AddJSON cannot be called from concurrent goroutines.
func (*Tracer) Done ¶
func (t *Tracer) Done()
Done finishes t.
Done cannot be called multiple times. Other Tracer functions cannot be called after Done call.
func (*Tracer) Donef ¶
Donef appends the given fmt.Sprintf(format, args..) message to t and finished it.
Donef cannot be called multiple times. Other Tracer functions cannot be called after Donef call.
func (*Tracer) NewChild ¶
NewChild adds a new child Tracer to t with the given fmt.Sprintf(format, args...) message.
The returned child must be closed via Done or Donef calls.
NewChild cannot be called from concurrent goroutines. Create children tracers from a single goroutine and then pass them to concurrent goroutines.
func (*Tracer) Printf ¶
Printf adds new fmt.Sprintf(format, args...) message to t.
Printf cannot be called from concurrent goroutines.