code: func (s *StdoutClient) SendEvents(events map[string]event.Event) error {
  	var n int
  	var stats = make([]string, 0)
  
  	for _, e := range events {
  		for _, stat := range e.Stats() {
  
  			stat = fmt.Sprintf("%s%s", s.prefix, strings.Replace(stat, "%HOST%", Hostname, 1))
  			_n := n + len(stat) + 1
  
  			if _n > UDPPayloadSize {
  				// with this last event, the UDP payload would be too big
  				if _, err := fmt.Fprintf(s.FD, strings.Join(stats, "\n")); err != nil {
  					return err
  				}
  				// reset payload after flushing, and add the last event
  				stats = []string{stat}
  				n = len(stat)
  				continue
  			}
  
  			// can fit more into the current payload
  			n = _n
  			stats = append(stats, stat)
  		}
  	}
  
  	if len(stats) != 0 {
  		if _, err := fmt.Fprintf(s.FD, strings.Join(stats, "\n")); err != nil {
  			return err
  		}
  	}
  
  	return nil
  }
docs: // SendEvents - Sends stats from all the event objects.
  // Tries to bundle many together into one fmt.Fprintf based on UDPPayloadSize.