From 590f7ab83c8203a0711dc1e1f75cc815c7891722 Mon Sep 17 00:00:00 2001 From: edouard Date: Sat, 19 Jun 2021 16:28:11 +0200 Subject: [PATCH] fix pubsub config flag --- cli/cli.go | 15 ++++++++++----- logging/logging.go | 4 ++-- pubsub/pubsub.go | 6 +++--- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index e5b0211..6d8b1d9 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -24,6 +24,12 @@ func New() *cli.App { Usage: "print the version", } + configFlag := cli.StringFlag{ + Name: "config", + Aliases: []string{"c"}, + Usage: "path to config file", + } + return &cli.App{ Name: "lntop", Version: version, @@ -31,11 +37,7 @@ func New() *cli.App { EnableShellCompletion: true, Action: run, Flags: []cli.Flag{ - &cli.StringFlag{ - Name: "config", - Aliases: []string{"c"}, - Usage: "path to config file", - }, + &configFlag, }, Commands: []*cli.Command{ { @@ -43,6 +45,9 @@ func New() *cli.App { Aliases: []string{""}, Usage: "run the pubsub only", Action: pubsubRun, + Flags: []cli.Flag{ + &configFlag, + }, }, }, } diff --git a/logging/logging.go b/logging/logging.go index ff2c7cb..78125ed 100644 --- a/logging/logging.go +++ b/logging/logging.go @@ -56,13 +56,13 @@ func New(cfg config.Logger) (Logger, error) { func NewProductionLogger(dest string) (Logger, error) { config := zap.NewProductionConfig() - config.OutputPaths = []string{dest} + config.OutputPaths = []string{"stderr", dest} return config.Build() } func NewDevelopmentLogger(dest string) (Logger, error) { config := zap.NewDevelopmentConfig() - config.OutputPaths = []string{dest} + config.OutputPaths = []string{"stderr", dest} return config.Build() } diff --git a/pubsub/pubsub.go b/pubsub/pubsub.go index 0d32459..c211b93 100644 --- a/pubsub/pubsub.go +++ b/pubsub/pubsub.go @@ -33,7 +33,7 @@ func (p *PubSub) invoices(ctx context.Context, sub chan *events.Event) { go func() { for invoice := range invoices { - p.logger.Debug("receive invoice", logging.Object("invoice", invoice)) + p.logger.Info("receive invoice", logging.Object("invoice", invoice)) if invoice.Settled { sub <- events.New(events.InvoiceSettled) } else { @@ -66,7 +66,7 @@ func (p *PubSub) transactions(ctx context.Context, sub chan *events.Event) { go func() { for tx := range transactions { - p.logger.Debug("receive transaction", logging.String("tx_hash", tx.TxHash)) + p.logger.Info("receive transaction", logging.String("tx_hash", tx.TxHash)) sub <- events.New(events.TransactionCreated) } p.wg.Done() @@ -95,7 +95,7 @@ func (p *PubSub) routingUpdates(ctx context.Context, sub chan *events.Event) { go func() { for hu := range routingUpdates { - p.logger.Debug("receive htlcUpdate") + p.logger.Info("receive htlcUpdate") sub <- events.NewWithData(events.RoutingEventUpdated, hu) } p.wg.Done()