(new): JSON HTML escaping control
Golang lint / lint (push) Successful in 45s

- add Formatter.JSONEscapeHTML and SetJSONEscapeHTML to let JSON writers preserve HTML-sensitive characters when needed while keeping escaping enabled by default.
- switch JSON output to json.Encoder, preserve existing Print/Println newline semantics, and cover the new escaping behavior in tests.
This commit is contained in:
2026-04-28 14:36:03 +03:00
parent a54a854a77
commit dd3c7286d2
5 changed files with 98 additions and 12 deletions
+2
View File
@@ -32,6 +32,7 @@ func main() {
jsonFormatter := sneklog.NewFormatter().
SetFormat("[%L] [%N] %m").
SetColorOutput(false).
SetJSONEscapeHTML(false).
SetTimeStampFormat(sneklog.Kitchen)
textStdout.SetFormatter(formatter)
@@ -62,6 +63,7 @@ func main() {
externalJSON,
)
logger.Infoln("Тест <>&")
logger.Infoln("service started")
logger.Warnln("cache miss")
logger.Errorln("request failed")