Selaa lähdekoodia

Use logger to print some debug messages than fmt.print

Phy 5 vuotta sitten
vanhempi
sitoutus
4d461bd172
2 muutettua tiedostoa jossa 3 lisäystä ja 3 poistoa
  1. 2 2
      cmd/tunasynctl/tunasynctl.go
  2. 1 1
      worker/cmd_provider.go

+ 2 - 2
cmd/tunasynctl/tunasynctl.go

@@ -55,6 +55,7 @@ type config struct {
 
 func loadConfig(cfgFile string, cfg *config) error {
 	if cfgFile != "" {
+		logger.Infof("Loading config: %s", cfgFile)
 		if _, err := toml.DecodeFile(cfgFile, cfg); err != nil {
 			logger.Errorf(err.Error())
 			return err
@@ -78,7 +79,6 @@ func initialize(c *cli.Context) error {
 	if _, err := os.Stat(systemCfgFile); err == nil {
 		loadConfig(systemCfgFile, cfg)
 	}
-	fmt.Println(os.ExpandEnv(userCfgFile))
 	if _, err := os.Stat(os.ExpandEnv(userCfgFile)); err == nil {
 		loadConfig(os.ExpandEnv(userCfgFile), cfg)
 	}
@@ -185,7 +185,7 @@ func listJobs(c *cli.Context) error {
 			fmt.Sprintf("Error printing out informations: %s", err.Error()),
 			1)
 	}
-	fmt.Printf(string(b))
+	fmt.Print(string(b))
 	return nil
 }
 

+ 1 - 1
worker/cmd_provider.go

@@ -96,7 +96,7 @@ func (p *cmdProvider) Run() error {
 	}
 	if p.failOnMatch != nil {
 		matches, err := internal.FindAllSubmatchInFile(p.LogFile(), p.failOnMatch)
-		fmt.Printf("FindAllSubmatchInFile: %q\n", matches)
+		logger.Infof("FindAllSubmatchInFile: %q\n", matches)
 		if err != nil {
 			return err
 		}