From 76f6bd0b2d96975323230d2401791837fcefddb0 Mon Sep 17 00:00:00 2001 From: Star Date: Thu, 24 Jul 2025 18:19:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0ssgo/log=E5=8C=85=E4=BB=A5?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E6=8B=86=E5=88=86=E6=97=A5=E5=BF=97=E6=97=B6?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=90=AF=E5=8A=A8log.Start=20=E5=9C=A8gojs?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E5=89=8D=E4=BC=9A=E5=81=9C=E6=AD=A2=E5=B9=B6?= =?UTF-8?q?=E7=AD=89=E5=BE=85=E6=97=A5=E5=BF=97=E5=86=99=E5=85=A5=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 12 ++++++------ log.go | 9 +++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 6e8bc2d..9055ab9 100644 --- a/go.mod +++ b/go.mod @@ -3,20 +3,20 @@ module apigo.cc/gojs/log go 1.23.0 require ( - apigo.cc/gojs v0.0.17 - github.com/ssgo/u v1.7.20 + apigo.cc/gojs v0.0.23 + github.com/ssgo/log v1.7.9 + github.com/ssgo/u v1.7.21 ) require ( github.com/dlclark/regexp2 v1.11.5 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect - github.com/google/pprof v0.0.0-20250607225305-033d6d78b36a // indirect + github.com/google/pprof v0.0.0-20250630185457-6e76a2b096b5 // indirect github.com/ssgo/config v1.7.9 // indirect - github.com/ssgo/log v1.7.7 // indirect github.com/ssgo/standard v1.7.7 // indirect github.com/ssgo/tool v0.4.29 // indirect - golang.org/x/sys v0.33.0 // indirect - golang.org/x/text v0.26.0 // indirect + golang.org/x/sys v0.34.0 // indirect + golang.org/x/text v0.27.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/log.go b/log.go index 1614ac5..6179490 100644 --- a/log.go +++ b/log.go @@ -6,6 +6,7 @@ import ( "apigo.cc/gojs" "apigo.cc/gojs/goja" + "github.com/ssgo/log" "github.com/ssgo/u" ) @@ -47,6 +48,14 @@ func init() { Desc: "logger api by github.com/ssgo/log", TsCode: logTS, Example: logMD, + // OnKill: func() { + // log.Stop() + // }, + // OnKill时其他任务可能还要写日志,所以在WaitForStop中才开始结束写入日志 + WaitForStop: func() { + log.Stop() + log.Wait() + }, }) }