mirror of
https://github.com/openziti/desktop-edge-win.git
synced 2026-10-14 00:29:48 +00:00
refine how log level is set to facilitate returning to UI/client
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
|
||||
package globals
|
||||
|
||||
import "C"
|
||||
import (
|
||||
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
|
||||
"github.com/michaelquigley/pfxlog"
|
||||
@@ -67,10 +66,9 @@ func InitLogger(level string) {
|
||||
}
|
||||
}
|
||||
|
||||
func SetLogLevel(level string){
|
||||
logrus.Infof("Setting logger levels to %s", level)
|
||||
l, cLevel := ParseLevel(level)
|
||||
logrus.SetLevel(l)
|
||||
func SetLogLevel(goLevel logrus.Level, cLevel int) {
|
||||
logrus.Infof("Setting logger levels to %s", goLevel)
|
||||
logrus.SetLevel(goLevel)
|
||||
cziti.SetLogLevel(cLevel)
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,7 @@ func SubMain(ops chan string, changes chan<- svc.Status) error {
|
||||
rts.LoadConfig()
|
||||
l := rts.state.LogLevel
|
||||
_, czitiLevel := globals.ParseLevel(l)
|
||||
|
||||
globals.InitLogger(l)
|
||||
|
||||
_ = globals.Elog.Info(InformationEvent, SvcName+" starting. log file located at "+config.LogFile())
|
||||
@@ -429,7 +430,9 @@ func serveIpc(conn net.Conn) {
|
||||
}
|
||||
|
||||
func setLogLevel(out *json.Encoder, level string) {
|
||||
globals.SetLogLevel(level)
|
||||
goLevel, cLevel := globals.ParseLevel(level)
|
||||
globals.SetLogLevel(goLevel, cLevel)
|
||||
rts.state.LogLevel = goLevel.String()
|
||||
respond(out, dto.Response{Message: "log level set", Code: SUCCESS, Error: "", Payload: nil})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user