[cleanup] remove unused flag and log file

Signed-off-by: Leo Chen <leo@harmony.one>
pull/3179/head
Leo Chen 5 years ago
parent fec81d1998
commit 119b363b25
  1. 7
      cmd/harmony/main.go
  2. 6
      internal/utils/singleton.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")

@ -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)
}

Loading…
Cancel
Save