Refactored main.go into cmd/jobsearch/main.go (in case separate commands are introduced later) which has required the options mechanism to change slightly as well as the logging.
This commit is contained in:
1 parent
de3ebf68c5
commit
6436253629
14 files changed
+273
-224
No files matched your search
@@ -81,10 +81,14 @@ func Init(cfgFile string, conf *JobSearchConfig) error {
|
||||
return err
|
||||
}
|
||||
|
||||
oldLogLevel := conf.Logging.Level
|
||||
// Load configuration from Viper, ensure -debug and -quiet are retained
|
||||
oldLogLevel := conf.Logging.LogLevel()
|
||||
LoadFromViper(conf)
|
||||
if ConfigLevelToLogLevel(oldLogLevel) < conf.Logging.LogLevel() {
|
||||
conf.Logging.Level = oldLogLevel
|
||||
if oldLogLevel == slog.LevelDebug {
|
||||
conf.Logging.Level = "debug"
|
||||
}
|
||||
if oldLogLevel == slog.LevelError {
|
||||
conf.Logging.Level = "error"
|
||||
}
|
||||
|
||||
if conf.Logging.LogLevel() <= slog.LevelDebug {
|
||||
|
||||
Reference in new issue
Block a user