允许配置json是否转义

This commit is contained in:
Yun
2025-01-15 15:29:45 +08:00
parent 33706c1072
commit fad8686a73
3 changed files with 29 additions and 8 deletions
+8
View File
@@ -21,6 +21,7 @@ type loggerOption struct {
fileSplit FileSplit // 文件切割规则
sizeSplit int // 根据文件大小切割
timeZone *time.Location // 时区
escapeHTML bool
}
type writeType uint8
@@ -44,6 +45,7 @@ func defaultOptions() loggerOption {
days: 7,
fileSplit: FileSplitTimeE,
timeZone: time.Local,
escapeHTML: true,
}
}
@@ -176,3 +178,9 @@ func SetSizeSplit(m int) Option {
o.sizeSplit = m
}
}
func SetEscapeHTML(b bool) Option {
return func(o *loggerOption) {
o.escapeHTML = b
}
}