also use -loglevel in localserve, and fail if the loglevel is invalid

This commit is contained in:
Mechiel Lukkien
2023-03-20 13:01:49 +01:00
parent 98b5a27fd2
commit d36419170b
2 changed files with 10 additions and 1 deletions

View File

@ -356,9 +356,11 @@ var pedantic bool
// loglevels from the config file.
func mustLoadConfig() {
mox.MustLoadConfig(false)
if level, ok := mlog.Levels[loglevel]; ok && loglevel != "" {
if level, ok := mlog.Levels[loglevel]; loglevel != "" && ok {
mox.Conf.Log[""] = level
mlog.SetConfig(mox.Conf.Log)
} else if loglevel != "" && !ok {
log.Fatal("unknown loglevel", mlog.Field("loglevel", loglevel))
}
if pedantic {
moxvar.Pedantic = true