Move logging setup to LoadSettings()

This commit is contained in:
Zorchenhimer 2019-03-30 14:23:04 -04:00
parent 0a817eff87
commit e7cfcd8688
2 changed files with 4 additions and 8 deletions

View File

@ -28,10 +28,6 @@ func setupSettings() error {
return fmt.Errorf("Missing stream key is settings.json")
}
if err = settings.SetupLogging(); err != nil {
return fmt.Errorf("Unable to setup logger: %s", err)
}
// Save admin password to file
if err = settings.Save(); err != nil {
return fmt.Errorf("Unable to save settings: %s", err)

View File

@ -56,6 +56,10 @@ func LoadSettings(filename string) (*Settings, error) {
}
s.filename = filename
if err = common.SetupLogging(s.LogLevel, s.LogFile); err != nil {
return nil, fmt.Errorf("Unable to setup logger: %s", err)
}
// have a default of 200
if s.MaxMessageCount == 0 {
s.MaxMessageCount = 300
@ -168,7 +172,3 @@ func (s *Settings) GetStreamKey() string {
}
return s.StreamKey
}
func (s *Settings) SetupLogging() error {
return common.SetupLogging(s.LogLevel, s.LogFile)
}