From 119b363b255c0e53ee047a82d048b0b78f02e4ea Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Sun, 14 Jun 2020 10:08:34 +0000 Subject: [PATCH] [cleanup] remove unused flag and log file Signed-off-by: Leo Chen --- cmd/harmony/main.go | 7 ------- internal/utils/singleton.go | 6 ------ 2 files changed, 13 deletions(-) diff --git a/cmd/harmony/main.go b/cmd/harmony/main.go index 0f502de5d..5672d99dd 100644 --- a/cmd/harmony/main.go +++ b/cmd/harmony/main.go @@ -69,7 +69,6 @@ var ( freshDB = flag.Bool("fresh_db", false, "true means the existing disk based db will be removed") pprof = flag.String("pprof", "", "what address and port the pprof profiling server should listen on") versionFlag = flag.Bool("version", false, "Output version info") - onlyLogTps = flag.Bool("only_log_tps", false, "Only log TPS if true") dnsZone = flag.String("dns_zone", "", "if given and not empty, use peers from the zone (default: use libp2p peer discovery instead)") dnsFlag = flag.Bool("dns", true, "[deprecated] equivalent to -dns_zone t.hmny.io") dnsPort = flag.String("dns_port", "9000", "port of dns node") @@ -140,11 +139,6 @@ func initSetup() { utils.SetLogVerbosity(log.Lvl(*verbosity)) utils.AddLogFile(fmt.Sprintf("%v/validator-%v-%v.log", *logFolder, *ip, *port), *logMaxSize) - if *onlyLogTps { - matchFilterHandler := log.MatchFilterHandler("msg", "TPS Report", utils.GetLogInstance().GetHandler()) - utils.GetLogInstance().SetHandler(matchFilterHandler) - } - // Add GOMAXPROCS to achieve max performance. runtime.GOMAXPROCS(runtime.NumCPU() * 4) @@ -577,7 +571,6 @@ func setupViperConfig() { viperconfig.ResetConfBool(freshDB, envViper, configFileViper, "", "fresh_db") viperconfig.ResetConfString(pprof, envViper, configFileViper, "", "pprof") viperconfig.ResetConfBool(versionFlag, envViper, configFileViper, "", "version") - viperconfig.ResetConfBool(onlyLogTps, envViper, configFileViper, "", "only_log_tps") viperconfig.ResetConfString(dnsZone, envViper, configFileViper, "", "dns_zone") viperconfig.ResetConfBool(dnsFlag, envViper, configFileViper, "", "dns") viperconfig.ResetConfInt(minPeers, envViper, configFileViper, "", "min_peers") diff --git a/internal/utils/singleton.go b/internal/utils/singleton.go index b874ef710..365d21b1d 100644 --- a/internal/utils/singleton.go +++ b/internal/utils/singleton.go @@ -53,12 +53,6 @@ func SetLogVerbosity(verbosity log.Lvl) { // AddLogFile creates a StreamHandler that outputs JSON logs // into rotating files with specified max file size func AddLogFile(filepath string, maxSize int) { - AddLogHandler(log.StreamHandler(&lumberjack.Logger{ - Filename: filepath, - MaxSize: maxSize, - Compress: true, - }, log.JSONFormat())) - setZeroLoggerFileOutput(filepath, maxSize) }