MCPcopy Index your code
hub / github.com/golang/example / New

Function New

slog-handler-guide/indenthandler4/indent_handler.go:36–45  ·  view source on GitHub ↗
(out io.Writer, opts *Options)

Source from the content-addressed store, hash-verified

34}
35
36func New(out io.Writer, opts *Options) *IndentHandler {
37 h := &IndentHandler{out: out, mu: &sync.Mutex{}}
38 if opts != nil {
39 h.opts = *opts
40 }
41 if h.opts.Level == nil {
42 h.opts.Level = slog.LevelInfo
43 }
44 return h
45}
46
47func (h *IndentHandler) Enabled(ctx context.Context, level slog.Level) bool {
48 return level >= h.opts.Level.Level()

Callers 3

TestSlogtestFunction · 0.70
TestFunction · 0.70
TestAllocFunction · 0.70

Calls

no outgoing calls

Tested by 3

TestSlogtestFunction · 0.56
TestFunction · 0.56
TestAllocFunction · 0.56