MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / newFormatterJSON

Function newFormatterJSON

logger/formatter_json.go:29–44  ·  view source on GitHub ↗

newFormatterJSON creates a new formatterJSON instance.

(groups []attrGroup, buf *buffer, gcpStyle bool)

Source from the content-addressed store, hash-verified

27
28// newFormatterJSON creates a new formatterJSON instance.
29func newFormatterJSON(groups []attrGroup, buf *buffer, gcpStyle bool) *formatterJSON {
30 f := &formatterJSON{
31 formatterCommon: newFormatterCommon(groups, buf),
32 }
33
34 // Set the level and message keys based on the style.
35 if gcpStyle {
36 f.levelKey = "severity"
37 f.messageKey = "message"
38 } else {
39 f.levelKey = slog.LevelKey
40 f.messageKey = slog.MessageKey
41 }
42
43 return f
44}
45
46// format formats a log record.
47func (s *formatterJSON) format(r slog.Record) {

Callers 1

formatMethod · 0.85

Calls 1

newFormatterCommonFunction · 0.85

Tested by

no test coverage detected