func (t *Trace) calculateStepThreshold() *time.Duration {
	if t.threshold == nil {
		return nil
	}
	lenTrace := len(t.traceItems) + 1
	traceThreshold := *t.threshold
	for _, s := range t.traceItems {
		nestedTrace, ok := s.(*Trace)
		if ok && nestedTrace.threshold != nil {
			traceThreshold = traceThreshold - *nestedTrace.threshold
			lenTrace--
		}
	}

	// the limit threshold is used when the threshold(
	//remaining after subtracting that of the child trace) is getting very close to zero to prevent unnecessary logging
	limitThreshold := *t.threshold / 4
	if traceThreshold < limitThreshold {
		traceThreshold = limitThreshold
		lenTrace = len(t.traceItems) + 1
	}

	stepThreshold := traceThreshold / time.Duration(lenTrace)
	return &stepThreshold
}
// calculateStepThreshold returns a threshold for the individual steps of a trace, or nil if there is no threshold and
// all steps should be written.
calculateStepThreshold returns a threshold for the individual steps of a trace, or nil if there is no threshold and
all steps should be written.
// calculateStepThreshold returns a threshold for the individual steps of a trace or nil if there is no threshold and // all steps should be written .
func (t *Trace) calculateStepThreshold() *time.Duration {
	if t.threshold == nil {
		return nil
	}
	lenTrace := len(t.traceItems) + 1
	traceThreshold := *t.threshold
	for _, s := range t.traceItems {
		nestedTrace, ok := s.(*Trace)
		if ok && nestedTrace.threshold != nil {
			traceThreshold = traceThreshold - *nestedTrace.threshold
			lenTrace--
		}
	}
	limitThreshold := *t.threshold / 4
	if traceThreshold < limitThreshold {
		traceThreshold = limitThreshold
		lenTrace = len(t.traceItems) + 1
	}
	stepThreshold := traceThreshold / time.Duration(lenTrace)
	return &stepThreshold
}
func ( t * Trace ) calculateStepThreshold ( ) * time . Duration { if t . threshold == nil { return nil } lenTrace := len ( t . traceItems ) + 1 traceThreshold := * t . threshold for _ , s := range t . traceItems { nestedTrace , ok := s . ( * Trace ) if ok && nestedTrace . threshold != nil { traceThreshold = traceThreshold - * nestedTrace . threshold lenTrace -- } } limitThreshold := * t . threshold / 4 if traceThreshold < limitThreshold { traceThreshold = limitThreshold lenTrace = len ( t . traceItems ) + 1 } stepThreshold := traceThreshold / time . Duration ( lenTrace ) return & stepThreshold }
calculateStepThreshold returns a threshold for the individual steps of a trace, or nil if there is no threshold and
all steps should be written.
calculateStepThreshold returns a threshold for the individual steps of a trace or nil if there is no threshold and all steps should be written .
// the limit threshold is used when the threshold( //remaining after subtracting that of the child trace) is getting very close to zero to prevent unnecessary logging