From 33aefc1d25498a59f7aed5fa93de3ebaba4818ca Mon Sep 17 00:00:00 2001 From: Andreas Neue Date: Mon, 2 Jul 2018 10:41:33 +0200 Subject: [PATCH] make logforward exit on error, saving buffer first --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 94aeb92..8c48ec6 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,6 @@ import ( "os" "time" - "git.dnix.de/an/xlog" goscp "github.com/bramvdbogaerde/go-scp" "github.com/bramvdbogaerde/go-scp/auth" "golang.org/x/crypto/ssh" @@ -40,7 +39,10 @@ func main() { time.Sleep(1 * time.Microsecond) line, err := reader.ReadString('\n') if err != nil { - xlog.Error(err.Error()) + fmt.Printf("%s\n", err.Error()) + l := []byte(log) + gzipAndSend(l) + return } else { log += line fmt.Printf("%d\r", len(log))