Add verbose logging (fixes #179)

This commit is contained in:
Jakob Borg
2015-04-30 20:21:48 +02:00
parent c9da8237df
commit fb312a71f7
4 changed files with 152 additions and 1 deletions

View File

@@ -194,6 +194,7 @@ var (
generateDir string
logFile string
auditEnabled bool
verbose bool
noRestart = os.Getenv("STNORESTART") != ""
noUpgrade = os.Getenv("STNOUPGRADE") != ""
guiAddress = os.Getenv("STGUIADDRESS") // legacy
@@ -231,6 +232,7 @@ func main() {
flag.BoolVar(&showVersion, "version", false, "Show version")
flag.StringVar(&upgradeTo, "upgrade-to", upgradeTo, "Force upgrade directly from specified URL")
flag.BoolVar(&auditEnabled, "audit", false, "Write events to audit file")
flag.BoolVar(&verbose, "verbose", false, "Print verbose log output")
flag.Usage = usageFor(flag.CommandLine, usage, fmt.Sprintf(extraUsage, baseDirs["config"]))
flag.Parse()
@@ -391,6 +393,10 @@ func syncthingMain() {
startAuditing(mainSvc)
}
if verbose {
mainSvc.Add(newVerboseSvc())
}
if len(os.Getenv("GOMAXPROCS")) == 0 {
runtime.GOMAXPROCS(runtime.NumCPU())
}