func StrategyFromString(str string) (Strategy, error) {
	switch str {
	case "end":
		return &AtTheEnd{}, nil
	case "periodically":
		return NewPeriodically(10 * time.Second), nil
	}

	if strings.HasPrefix(str, "periodically") && strings.Count(str, ",") == 1 {
		parts := strings.Split(str, ",")

		msecs, err := strconv.Atoi(parts[1])
		if err != nil {
			return &AtTheEnd{}, fmt.Errorf("StrategyFromString: can't parse flush strategy: %s", str)
		}

		return NewPeriodically(time.Duration(msecs) * time.Millisecond), nil
	}

	return &AtTheEnd{}, fmt.Errorf("StrategyFromString: can't parse flush strategy: %s", str)
}
// StrategyFromString returns a flush strategy from the given string.
// Possible values:
//   - end
//   - periodically[,milliseconds]
StrategyFromString returns a flush strategy from the given string.
Possible values:
- end
- periodically[,milliseconds]
// StrategyFromString returns a flush strategy from the given string . // Possible values : // - end // - periodically [ milliseconds ]
func StrategyFromString(str string) (Strategy, error) {
	switch str {
	case "end":
		return &AtTheEnd{}, nil
	case "periodically":
		return NewPeriodically(10 * time.Second), nil
	}
	if strings.HasPrefix(str, "periodically") && strings.Count(str, ",") == 1 {
		parts := strings.Split(str, ",")
		msecs, err := strconv.Atoi(parts[1])
		if err != nil {
			return &AtTheEnd{}, fmt.Errorf("StrategyFromString: can't parse flush strategy: %s", str)
		}
		return NewPeriodically(time.Duration(msecs) * time.Millisecond), nil
	}
	return &AtTheEnd{}, fmt.Errorf("StrategyFromString: can't parse flush strategy: %s", str)
}
func StrategyFromString ( str string ) ( Strategy , error ) { switch str { case " " : return & AtTheEnd { } , nil case " " : return NewPeriodically ( 10 * time . Second ) , nil } if strings . HasPrefix ( str , " " ) && strings . Count ( str , " " ) == 1 { parts := strings . Split ( str , " " ) msecs , err := strconv . Atoi ( parts [ 1 ] ) if err != nil { return & AtTheEnd { } , fmt . Errorf ( " " , str ) } return NewPeriodically ( time . Duration ( msecs ) * time . Millisecond ) , nil } return & AtTheEnd { } , fmt . Errorf ( " " , str ) }
StrategyFromString returns a flush strategy from the given string.
StrategyFromString returns a flush strategy from the given string .