add recorder

This commit is contained in:
Yavolte 2025-06-17 18:33:28 +08:00
parent 7098529421
commit ef4ad92e35
2 changed files with 21 additions and 10 deletions

View File

@ -394,5 +394,9 @@ func Init(ctx context.Context, cbs ...Option) (err error) {
return return
} }
} }
if !opts.disableRecorder {
//启用操作记录
NewActivityRecorder(ctx, opts.db).Recoder()
}
return return
} }

View File

@ -28,6 +28,7 @@ type (
vuePath string //生成Vue文件的路径,如果指定了启动的时候会自动生成Vue的文件 vuePath string //生成Vue文件的路径,如果指定了启动的时候会自动生成Vue的文件
translate Translate translate Translate
disableDefault bool disableDefault bool
disableRecorder bool
httpServer *http.Server httpServer *http.Server
restOpts []rest.Option restOpts []rest.Option
} }
@ -68,6 +69,12 @@ func WithoutDefault() Option {
} }
} }
func WithoutRecorder() Option {
return func(o *options) {
o.disableRecorder = true
}
}
func WithHttpServer(server *http.Server) Option { func WithHttpServer(server *http.Server) Option {
return func(o *options) { return func(o *options) {
o.httpServer = server o.httpServer = server