~bayindirh/nudge

4ddd594d1f5a48533bf090b98bb5a81f740bf6c0 — Hakan Bayindir 1 year, 1 month ago 3c9da8a
refactor: Further remove logfile support.

- refactor: Logging file path support removed from  runTimeConfiguration  struct and  readAndApplyConfiguration function.
2 files changed, 1 insertions(+), 9 deletions(-)

M CHANGELOG.md
M src/nudge.go
M CHANGELOG.md => CHANGELOG.md +1 -0
@@ 4,6 4,7 @@

## 2023-10-16

- refactor: Logging file path support removed from `runTimeConfiguration` struct and `readAndApplyConfiguration` function.
- refactor: Remove a couple of information lines from `printState` function. Because logging file support is going away.
- refactor: Move logger initialization to the beginning of the process.


M src/nudge.go => src/nudge.go +0 -9
@@ 57,7 57,6 @@ type RuntimeConfiguration struct {
	configFilePath  string   // This variable stores our configuration file's path.
	apiKey          string   // Secret key we use for sending messages.
	userKey         string   // Secret key of the user, used as a recipient address.
	logfilePaths    []string // Contains the absolute path for the logfile.
	logLevel        string   // Contains the logging level the application starts with.
}



@@ 120,7 119,6 @@ func applyDefaultConfiguration(runtimeConfiguration *RuntimeConfiguration, notif
	runtimeConfiguration.applicationName = applicationName[len(applicationName)-1]
	runtimeConfiguration.version = "0.3.0a1"
	runtimeConfiguration.dryrun = false
	runtimeConfiguration.logfilePaths = []string{"stdout"}
	runtimeConfiguration.logLevel = "warn"
}



@@ 189,13 187,6 @@ func readAndApplyConfiguration(configurationFilePath *string, runtimeConfigurati
			logger.Debugf("Pushover User key is found & set to %s.", runtimeConfiguration.userKey)
		}

		// Logging related configuration follows:
		// Logging paths:
		if viper.IsSet("logging.logging_paths") {
			runtimeConfiguration.logfilePaths = viper.GetStringSlice("logging.logging_paths")
			logger.Debugf("Logging paths are found & set to %s.", runtimeConfiguration.logfilePaths)
		}

		// Logging level:
		if viper.IsSet("logging.log_level") {
			runtimeConfiguration.logLevel = viper.GetString("logging.log_level")