Merge pull request #1034 from filecoin-project/feat/lotuslog

Set logging levels in a single place
This commit is contained in:
Jakub Sztandera 2020-01-08 14:57:55 +01:00 committed by GitHub
commit 83cbf141a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 10 deletions

View File

@ -12,6 +12,7 @@ import (
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build"
lcli "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/lib/lotuslog"
"github.com/filecoin-project/lotus/node/repo"
manet "github.com/multiformats/go-multiaddr-net"
)
@ -19,7 +20,7 @@ import (
var log = logging.Logger("main")
func main() {
logging.SetLogLevel("*", "INFO")
lotuslog.SetupLogLevels()
log.Info("Starting lotus worker")

View File

@ -9,6 +9,7 @@ import (
"github.com/filecoin-project/lotus/build"
lcli "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/lib/lotuslog"
"github.com/filecoin-project/lotus/node/repo"
"github.com/filecoin-project/lotus/tracing"
)
@ -18,8 +19,7 @@ var log = logging.Logger("main")
const FlagStorageRepo = "storagerepo"
func main() {
logging.SetLogLevel("*", "INFO")
logging.SetLogLevel("swarm", "WARN")
lotuslog.SetupLogLevels()
local := []*cli.Command{
runCmd,

View File

@ -4,23 +4,18 @@ import (
"context"
"os"
logging "github.com/ipfs/go-log"
"go.opencensus.io/trace"
"gopkg.in/urfave/cli.v2"
"github.com/filecoin-project/lotus/build"
lcli "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/lib/lotuslog"
"github.com/filecoin-project/lotus/node/repo"
"github.com/filecoin-project/lotus/tracing"
)
func main() {
logging.SetLogLevel("*", "INFO")
logging.SetLogLevel("dht", "ERROR")
logging.SetLogLevel("swarm2", "WARN")
logging.SetLogLevel("bitswap", "WARN")
logging.SetLogLevel("pubsub", "WARN")
logging.SetLogLevel("connmgr", "WARN")
lotuslog.SetupLogLevels()
local := []*cli.Command{
DaemonCmd,

12
lib/lotuslog/levels.go Normal file
View File

@ -0,0 +1,12 @@
package lotuslog
import logging "github.com/ipfs/go-log"
func SetupLogLevels() {
logging.SetLogLevel("*", "INFO")
logging.SetLogLevel("dht", "ERROR")
logging.SetLogLevel("swarm2", "WARN")
logging.SetLogLevel("bitswap", "WARN")
logging.SetLogLevel("pubsub", "WARN")
logging.SetLogLevel("connmgr", "WARN")
}