func TestSyslogProducer(t *testing.T) {
	topic := fmt.Sprintf("syslog-producer-%d", time.Now().Unix())

	consumeMessages := 100
	timeout := 1 * time.Minute
	consumeStatus := make(chan int)

	CreateMultiplePartitionsTopic(localZk, topic, 1)
	EnsureHasLeader(localZk, topic)

	config := syslog.NewSyslogProducerConfig()
	config.ProducerConfig = producer.NewProducerConfig()
	config.BrokerList = localBroker
	config.NumProducers = 1
	config.TCPAddr = tcpAddr
	config.Topic = topic
	syslogProducer := syslog.NewSyslogProducer(config)
	go syslogProducer.Start()

	time.Sleep(2 * time.Second)
	for i := 0; i < 100; i++ {
		logMessage()
	}

	consumerConfig := testConsumerConfig()
	consumerConfig.Strategy = newCountingStrategy(t, consumeMessages, timeout, consumeStatus)
	consumer := NewConsumer(consumerConfig)
	go consumer.StartStatic(map[string]int{topic: 1})
	if actual := <-consumeStatus; actual != consumeMessages {
		t.Errorf("Failed to consume %d messages within %s. Actual messages = %d", consumeMessages, timeout, actual)
	}
	closeWithin(t, 10*time.Second, consumer)
	syslogProducer.Stop()
}
func parseAndValidateArgs() *syslog.SyslogProducerConfig {
	tag = make(map[string]string)
	flag.Var(tag, "tag", "")
	flag.Parse()

	setLogLevel()
	runtime.GOMAXPROCS(*maxProcs)

	if *brokerList == "" {
		fmt.Println("broker.list is required.")
		os.Exit(1)
	}

	if *topic == "" {
		fmt.Println("Topic is required.")
		os.Exit(1)
	}

	if *queueSize < 0 {
		fmt.Println("Queue size should be equal or greater than 0")
		os.Exit(1)
	}

	config := syslog.NewSyslogProducerConfig()
	conf, err := producer.ProducerConfigFromFile(*producerConfig)
	useFile := true
	if err != nil {
		//we dont have a producer configuraiton which is ok
		useFile = false
	}

	if useFile {
		config.ProducerConfig = conf
	} else {
		config.ProducerConfig = producer.NewProducerConfig()
		config.ProducerConfig.RequiredAcks = *requiredAcks
		config.ProducerConfig.AckTimeoutMs = int32(*acksTimeout)
	}
	config.NumProducers = *numProducers
	config.Topic = *topic
	config.BrokerList = *brokerList
	config.TCPAddr = fmt.Sprintf("%s:%s", *tcpHost, *tcpPort)
	config.UDPAddr = fmt.Sprintf("%s:%s", *udpHost, *udpPort)

	if !(*source == "" && len(tag) == 0 && *logtypeid == math.MinInt64) {
		config.Transformer = protobufTransformer
	}

	return config
}