From a0516ddf8130d976f2082f575cec8982bb1e5661 Mon Sep 17 00:00:00 2001 From: Eugene Zagidullin Date: Thu, 20 Jun 2024 22:09:37 +0300 Subject: [PATCH] Some debug info --- config.yaml | 4 ++-- main.go | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/config.yaml b/config.yaml index cf6479b..cf7fc07 100644 --- a/config.yaml +++ b/config.yaml @@ -1,3 +1,3 @@ listen: :8080 -url: https://ghostnet.ecadinfra.com -chain_id: NetXnHfVqm9iesp +url: http://10.100.20.44 +chain_id: NetXXWAHLEvre9b diff --git a/main.go b/main.go index e2fd0b6..3bb9ca2 100644 --- a/main.go +++ b/main.go @@ -25,6 +25,12 @@ const ( defaultReconnectDelay = 10 * time.Second ) +type debugLogger log.Logger + +func (l *debugLogger) Printf(format string, a ...any) { + (*log.Logger)(l).Debugf(format, a...) +} + func main() { logLevel := flag.String("l", "info", "Log level: [error, warn, info, debug, trace]") confPath := flag.String("c", "", "Config file path") @@ -53,9 +59,12 @@ func main() { if err := yaml.Unmarshal(buf, &conf); err != nil { log.Fatal(err) } + tmp, _ := json.MarshalIndent(&conf, "", " ") + log.Info(string(tmp)) cl := client.Client{ - URL: conf.URL, + URL: conf.URL, + DebugLogger: (*debugLogger)(log.StandardLogger()), } mon := HeadMonitor{