From 61bb4a036aa31f51b2dd964c2ffc2c169abbe6fa Mon Sep 17 00:00:00 2001 From: David Florness Date: Tue, 9 Jun 2020 01:02:33 -0600 Subject: [PATCH] Enable loggers on -d flag --- TODO.org | 1 - main.go | 14 +++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/TODO.org b/TODO.org index 3a90cc1..af427e8 100644 --- a/TODO.org +++ b/TODO.org @@ -8,7 +8,6 @@ * support getting inputs from peer other than owner * make input right away to avoid lock BS * warn about 2 voters -* enable loggers on -d flag * symbol->string * ~a for string conv * handle user breaks diff --git a/main.go b/main.go index e6cac76..738d6a4 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "bufio" "context" + "flag" "fmt" "io" "os" @@ -169,9 +170,16 @@ func bootstrap() { func main() { log.SetAllLoggers(logging.WARNING) - log.SetLogLevel("dht", "critical") - log.SetLogLevel("relay", "critical") - log.SetLogLevel("tallyard", "critical") + + debug := flag.Bool("d", false, "enable extra logging for debugging") + flag.Parse() + if *debug { + log.SetLogLevel("tallyard", "info") + } else { + log.SetLogLevel("dht", "critical") + log.SetLogLevel("relay", "critical") + log.SetLogLevel("tallyard", "critical") + } app := tview.NewApplication() modal := tview.NewModal(). -- 2.38.4