func Connect() {
	linePrefix = setup()
	conn, err := grpc.Dial(viper.GetString("connect.address"), grpc.WithInsecure())
	if err != nil {
		log.Fatalf("did not connect: %v", err)
	}
	defer conn.Close()
	c := pb.NewLogTransferClient(conn)
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		var (
			res *pb.LineResult
			err error
		)
		content := scanner.Text()
		if viper.GetBool("connect.pass-through") {
			fmt.Println(content)
		}
		if "" == linePrefix {
			res, err = c.SendLine(context.Background(), &pb.LineMessage{Line: content, Priority: int32(viper.GetInt("connect.priority"))})
		} else {
			res, err = c.SendLine(context.Background(), &pb.LineMessage{Line: fmt.Sprintf("[%s] %s", linePrefix, content), Priority: int32(viper.GetInt("connect.priority"))})
		}
		if !res.Result || nil != err {
			log.Fatal(err)
		}
	}
	if err := scanner.Err(); err != nil {
		log.Warnf("reading standard input:", err)
	}
}
Connect is used to connect to a go-logsink server
package client
import (
	"bufio"
	"fmt"
	"os"
	log "github.com/sirupsen/logrus"
	pb "github.com/sascha-andres/go-logsink/logsink"
	"github.com/spf13/viper"
	"golang.org/x/net/context"
	"google.golang.org/grpc"
)
var (
	linePrefix string
)
func setup() string {
	if !viper.GetBool("connect.pass-through") {
		log.Printf("Connecting to %s\n", viper.GetString("connect.address"))
	}
	return viper.GetString("connect.prefix")
}