Cleanup logging

This commit is contained in:
2022-01-16 20:35:35 +10:30
parent d8672139f5
commit 739aca19e7
5 changed files with 43 additions and 64 deletions

View File

@@ -13,15 +13,13 @@ import (
)
func main() {
// log.SetFlags(log.Lshortfile)
// flag.Int("port", 4912, "Port to run server/client on.")
// addr := flag.String("a", "127.0.0.1", "address to connect to.")
isServer := flag.Bool("s", false, "Run netgiv in server mode")
// client mode flags
isList := flag.Bool("l", false, "Set if requesting a list")
isSend := flag.Bool("c", false, "sending stdin to netgiv server (copy)")
isReceive := flag.Bool("p", false, "receive file from netgiv server to stdout (paste)")
debug := flag.Bool("debug", false, "turn on debug logging")
flag.String("address", "", "IP address/hostname of the netgiv server")
helpConfig := flag.Bool("help-config", false, "Show help on netgiv configuration")
@@ -102,6 +100,10 @@ environment variable. This may be preferable in some environments.
}
if *debug {
log.SetLevel(log.DebugLevel)
}
if *isServer {
s := Server{port: port, authToken: authtoken}
s.Run()