mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 16:33:47 +03:00
also use -loglevel in localserve, and fail if the loglevel is invalid
This commit is contained in:
parent
98b5a27fd2
commit
d36419170b
2 changed files with 10 additions and 1 deletions
|
@ -86,6 +86,13 @@ during those commands instead of during "data".
|
|||
log.Fatalx("loading mox localserve config (hint: when creating a new config with -dir, the directory must not yet exist)", err, mlog.Field("dir", dir))
|
||||
}
|
||||
|
||||
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))
|
||||
}
|
||||
|
||||
// Initialize receivedid.
|
||||
recvidbuf, err := os.ReadFile(filepath.Join(dir, "receivedid.key"))
|
||||
if err == nil && len(recvidbuf) != 16+8 {
|
||||
|
|
4
main.go
4
main.go
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue