MCPcopy
hub / github.com/netdata/netdata / newTextHandler

Function newTextHandler

src/go/logger/handler.go:13–33  ·  view source on GitHub ↗
(w io.Writer)

Source from the content-addressed store, hash-verified

11)
12
13func newTextHandler(w io.Writer) slog.Handler {
14 return slog.NewTextHandler(w, &slog.HandlerOptions{
15 Level: Level.lvl,
16 ReplaceAttr: func(groups []string, a slog.Attr) slog.Attr {
17 switch a.Key {
18 case slog.TimeKey:
19 if isJournal {
20 return slog.Attr{}
21 }
22 case slog.LevelKey:
23 lvl := a.Value.Any().(slog.Level)
24 s, ok := customLevels[lvl]
25 if !ok {
26 s = lvl.String()
27 }
28 return slog.String(a.Key, strings.ToLower(s))
29 }
30 return a
31 },
32 })
33}
34
35func newTerminalHandler(w io.Writer) slog.Handler {
36 return tint.NewHandler(w, &tint.Options{

Callers 1

newLoggerFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…