From 7b21b28b98267dc1d16d0d6ba5d4721473ff3cae Mon Sep 17 00:00:00 2001 From: shy Date: Tue, 9 Jul 2024 19:49:29 +0800 Subject: [PATCH] add some --- base/web/dream.go | 9 ++++++++- logs.go | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/base/web/dream.go b/base/web/dream.go index 41211c8b..2a5f7dbe 100644 --- a/base/web/dream.go +++ b/base/web/dream.go @@ -148,7 +148,14 @@ func _dream_check(m *ice.Message, name string) string { p := path.Join(ice.USR_LOCAL_WORK, name) if pp := path.Join(p, ice.VAR_LOG_ICE_PID); nfs.Exists(m, pp) { for i := 0; i < 5; i++ { - if pid := m.Cmdx(nfs.CAT, pp, kit.Dict(ice.MSG_USERROLE, aaa.TECH)); pid != "" && nfs.Exists(m, "/proc/"+pid) { + pid := m.Cmdx(nfs.CAT, pp, kit.Dict(ice.MSG_USERROLE, aaa.TECH)) + if pid == "" { + return p + } + if !kit.HasPrefix(m.Cmdx(nfs.CAT, "/proc/"+pid+"/cmdline"), kit.Path("bin/ice.bin"), kit.Path(p, "bin/ice.bin")) { + return p + } + if nfs.Exists(m, "/proc/"+pid) { m.Info("already exists %v", pid) } else if gdb.SignalProcess(m, pid) { m.Info("already exists %v", pid) diff --git a/logs.go b/logs.go index bbdd9eb6..73237bb8 100644 --- a/logs.go +++ b/logs.go @@ -52,11 +52,8 @@ func (m *Message) join(arg ...Any) (string, []Any) { return kit.Join(list, SP), meta } func (m *Message) log(level string, str string, arg ...Any) *Message { - if !strings.Contains(Info.Make.Domain, "debug=true") { - return m - } if m.Option(LOG_DISABLE) == TRUE { - // return m + return m } args, traceid := []Any{}, "" for _, v := range arg { @@ -68,6 +65,9 @@ func (m *Message) log(level string, str string, arg ...Any) *Message { } _source := logs.FileLineMeta(3) kit.If(Info.Log != nil, func() { Info.Log(m, m.FormatPrefix(traceid), level, logs.Format(str, append(args, _source)...)) }) + if !strings.Contains(Info.Make.Domain, "debug=true") { + return m + } prefix, suffix := "", "" if Info.Colors { switch level {