summaryrefslogtreecommitdiff
path: root/cmd/dgrep/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/dgrep/main.go')
-rw-r--r--cmd/dgrep/main.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/cmd/dgrep/main.go b/cmd/dgrep/main.go
index 602d318..02b2463 100644
--- a/cmd/dgrep/main.go
+++ b/cmd/dgrep/main.go
@@ -3,7 +3,6 @@ package main
import (
"context"
"flag"
- "fmt"
"os"
"sync"
@@ -25,7 +24,7 @@ func main() {
var args config.Args
var displayVersion bool
var grep string
- var pprof int
+ var pprof string
userName := user.Name()
flag.BoolVar(&args.NoColor, "noColor", false, "Disable ANSII terminal colors")
@@ -40,7 +39,6 @@ func main() {
flag.IntVar(&args.LContext.BeforeContext, "before", 0, "Print lines of leading context before matching lines")
flag.IntVar(&args.LContext.MaxCount, "max", 0, "Stop reading file after NUM matching lines")
flag.IntVar(&args.SSHPort, "port", config.DefaultSSHPort, "SSH server port")
- flag.IntVar(&pprof, "pprof", -1, "Start PProf server this port")
flag.StringVar(&args.ConfigFile, "cfg", "", "Config file path")
flag.StringVar(&args.Discovery, "discovery", "", "Server discovery method")
flag.StringVar(&args.LogDir, "logDir", "~/log", "Log dir")
@@ -52,6 +50,7 @@ func main() {
flag.StringVar(&args.UserName, "user", userName, "Your system user name")
flag.StringVar(&args.What, "files", "", "File(s) to read")
flag.StringVar(&grep, "grep", "", "Alias for -regex")
+ flag.StringVar(&pprof, "pprof", "", "Start PProf server this address")
flag.Parse()
config.Setup(source.Client, &args, flag.Args())
@@ -69,11 +68,9 @@ func main() {
args.RegexStr = grep
}
- if pprof > -1 {
- // For debugging purposes only
- pprofArgs := fmt.Sprintf("0.0.0.0:%d", pprof)
- go http.ListenAndServe(pprofArgs, nil)
- dlog.Client.Info("Started PProf", pprofArgs)
+ if pprof != "" {
+ go http.ListenAndServe(pprof, nil)
+ dlog.Client.Info("Started PProf", pprof)
}
client, err := clients.NewGrepClient(args)