Source file src/log/slog/handler.go

     1  // Copyright 2022 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package slog
     6  
     7  import (
     8  	"context"
     9  	"fmt"
    10  	"io"
    11  	"log/slog/internal/buffer"
    12  	"reflect"
    13  	"slices"
    14  	"strconv"
    15  	"sync"
    16  	"time"
    17  )
    18  
    19  // A Handler handles log records produced by a Logger.
    20  //
    21  // A typical handler may print log records to standard error,
    22  // or write them to a file or database, or perhaps augment them
    23  // with additional attributes and pass them on to another handler.
    24  //
    25  // Any of the Handler's methods may be called concurrently with itself
    26  // or with other methods. It is the responsibility of the Handler to
    27  // manage this concurrency.
    28  //
    29  // Users of the slog package should not invoke Handler methods directly.
    30  // They should use the methods of [Logger] instead.
    31  //
    32  // Before implementing your own handler, consult https://go.dev/s/slog-handler-guide.
    33  type Handler interface {
    34  	// Enabled reports whether the handler handles records at the given level.
    35  	// The handler ignores records whose level is lower.
    36  	// It is called early, before any arguments are processed,
    37  	// to save effort if the log event should be discarded.
    38  	// If called from a Logger method, the first argument is the context
    39  	// passed to that method, or context.Background() if nil was passed
    40  	// or the method does not take a context.
    41  	// The context is passed so Enabled can use its values
    42  	// to make a decision.
    43  	Enabled(context.Context, Level) bool
    44  
    45  	// Handle handles the Record.
    46  	// It will only be called when Enabled returns true.
    47  	// The Context argument is as for Enabled.
    48  	// It is present solely to provide Handlers access to the context's values.
    49  	// Canceling the context should not affect record processing.
    50  	// (Among other things, log messages may be necessary to debug a
    51  	// cancellation-related problem.)
    52  	//
    53  	// Handle methods that produce output should observe the following rules:
    54  	//   - If r.Time is the zero time, ignore the time.
    55  	//   - If r.PC is zero, ignore it.
    56  	//   - Attr's values should be resolved.
    57  	//   - If an Attr's key and value are both the zero value, ignore the Attr.
    58  	//     This can be tested with attr.Equal(Attr{}).
    59  	//   - If a group's key is empty, inline the group's Attrs.
    60  	//   - If a group has no Attrs (even if it has a non-empty key),
    61  	//     ignore it.
    62  	//
    63  	// [Logger] discards any errors from Handle. Wrap the Handle method to
    64  	// process any errors from Handlers.
    65  	Handle(context.Context, Record) error
    66  
    67  	// WithAttrs returns a new Handler whose attributes consist of
    68  	// both the receiver's attributes and the arguments.
    69  	// The Handler owns the slice: it may retain, modify or discard it.
    70  	WithAttrs(attrs []Attr) Handler
    71  
    72  	// WithGroup returns a new Handler with the given group appended to
    73  	// the receiver's existing groups.
    74  	// The keys of all subsequent attributes, whether added by With or in a
    75  	// Record, should be qualified by the sequence of group names.
    76  	//
    77  	// How this qualification happens is up to the Handler, so long as
    78  	// this Handler's attribute keys differ from those of another Handler
    79  	// with a different sequence of group names.
    80  	//
    81  	// A Handler should treat WithGroup as starting a Group of Attrs that ends
    82  	// at the end of the log event. That is,
    83  	//
    84  	//     logger.WithGroup("s").LogAttrs(ctx, level, msg, slog.Int("a", 1), slog.Int("b", 2))
    85  	//
    86  	// should behave like
    87  	//
    88  	//     logger.LogAttrs(ctx, level, msg, slog.Group("s", slog.Int("a", 1), slog.Int("b", 2)))
    89  	//
    90  	// If the name is empty, WithGroup returns the receiver.
    91  	WithGroup(name string) Handler
    92  }
    93  
    94  type defaultHandler struct {
    95  	ch *commonHandler
    96  	// internal.DefaultOutput, except for testing
    97  	output func(pc uintptr, data []byte) error
    98  }
    99  
   100  func newDefaultHandler(output func(uintptr, []byte) error) *defaultHandler {
   101  	return &defaultHandler{
   102  		ch:     &commonHandler{json: false},
   103  		output: output,
   104  	}
   105  }
   106  
   107  func (*defaultHandler) Enabled(_ context.Context, l Level) bool {
   108  	return l >= logLoggerLevel.Level()
   109  }
   110  
   111  // Collect the level, attributes and message in a string and
   112  // write it with the default log.Logger.
   113  // Let the log.Logger handle time and file/line.
   114  func (h *defaultHandler) Handle(ctx context.Context, r Record) error {
   115  	buf := buffer.New()
   116  	buf.WriteString(r.Level.String())
   117  	buf.WriteByte(' ')
   118  	buf.WriteString(r.Message)
   119  	state := h.ch.newHandleState(buf, true, " ")
   120  	defer state.free()
   121  	state.appendNonBuiltIns(r)
   122  	return h.output(r.PC, *buf)
   123  }
   124  
   125  func (h *defaultHandler) WithAttrs(as []Attr) Handler {
   126  	return &defaultHandler{h.ch.withAttrs(as), h.output}
   127  }
   128  
   129  func (h *defaultHandler) WithGroup(name string) Handler {
   130  	return &defaultHandler{h.ch.withGroup(name), h.output}
   131  }
   132  
   133  // HandlerOptions are options for a [TextHandler] or [JSONHandler].
   134  // A zero HandlerOptions consists entirely of default values.
   135  type HandlerOptions struct {
   136  	// AddSource causes the handler to compute the source code position
   137  	// of the log statement and add a SourceKey attribute to the output.
   138  	AddSource bool
   139  
   140  	// Level reports the minimum record level that will be logged.
   141  	// The handler discards records with lower levels.
   142  	// If Level is nil, the handler assumes LevelInfo.
   143  	// The handler calls Level.Level for each record processed;
   144  	// to adjust the minimum level dynamically, use a LevelVar.
   145  	Level Leveler
   146  
   147  	// ReplaceAttr is called to rewrite each non-group attribute before it is logged.
   148  	// The attribute's value has been resolved (see [Value.Resolve]).
   149  	// If ReplaceAttr returns a zero Attr, the attribute is discarded.
   150  	//
   151  	// The built-in attributes with keys "time", "level", "source", and "msg"
   152  	// are passed to this function, except that time is omitted
   153  	// if zero, and source is omitted if AddSource is false.
   154  	//
   155  	// The first argument is a list of currently open groups that contain the
   156  	// Attr. It must not be retained or modified. ReplaceAttr is never called
   157  	// for Group attributes, only their contents. For example, the attribute
   158  	// list
   159  	//
   160  	//     Int("a", 1), Group("g", Int("b", 2)), Int("c", 3)
   161  	//
   162  	// results in consecutive calls to ReplaceAttr with the following arguments:
   163  	//
   164  	//     nil, Int("a", 1)
   165  	//     []string{"g"}, Int("b", 2)
   166  	//     nil, Int("c", 3)
   167  	//
   168  	// ReplaceAttr can be used to change the default keys of the built-in
   169  	// attributes, convert types (for example, to replace a `time.Time` with the
   170  	// integer seconds since the Unix epoch), sanitize personal information, or
   171  	// remove attributes from the output.
   172  	ReplaceAttr func(groups []string, a Attr) Attr
   173  }
   174  
   175  // Keys for "built-in" attributes.
   176  const (
   177  	// TimeKey is the key used by the built-in handlers for the time
   178  	// when the log method is called. The associated Value is a [time.Time].
   179  	TimeKey = "time"
   180  	// LevelKey is the key used by the built-in handlers for the level
   181  	// of the log call. The associated value is a [Level].
   182  	LevelKey = "level"
   183  	// MessageKey is the key used by the built-in handlers for the
   184  	// message of the log call. The associated value is a string.
   185  	MessageKey = "msg"
   186  	// SourceKey is the key used by the built-in handlers for the source file
   187  	// and line of the log call. The associated value is a *[Source].
   188  	SourceKey = "source"
   189  )
   190  
   191  type commonHandler struct {
   192  	json              bool // true => output JSON; false => output text
   193  	opts              HandlerOptions
   194  	preformattedAttrs []byte
   195  	// groupPrefix is for the text handler only.
   196  	// It holds the prefix for groups that were already pre-formatted.
   197  	// A group will appear here when a call to WithGroup is followed by
   198  	// a call to WithAttrs.
   199  	groupPrefix string
   200  	groups      []string // all groups started from WithGroup
   201  	nOpenGroups int      // the number of groups opened in preformattedAttrs
   202  	mu          *sync.Mutex
   203  	w           io.Writer
   204  }
   205  
   206  func (h *commonHandler) clone() *commonHandler {
   207  	// We can't use assignment because we can't copy the mutex.
   208  	return &commonHandler{
   209  		json:              h.json,
   210  		opts:              h.opts,
   211  		preformattedAttrs: slices.Clip(h.preformattedAttrs),
   212  		groupPrefix:       h.groupPrefix,
   213  		groups:            slices.Clip(h.groups),
   214  		nOpenGroups:       h.nOpenGroups,
   215  		w:                 h.w,
   216  		mu:                h.mu, // mutex shared among all clones of this handler
   217  	}
   218  }
   219  
   220  // enabled reports whether l is greater than or equal to the
   221  // minimum level.
   222  func (h *commonHandler) enabled(l Level) bool {
   223  	minLevel := LevelInfo
   224  	if h.opts.Level != nil {
   225  		minLevel = h.opts.Level.Level()
   226  	}
   227  	return l >= minLevel
   228  }
   229  
   230  func (h *commonHandler) withAttrs(as []Attr) *commonHandler {
   231  	// We are going to ignore empty groups, so if the entire slice consists of
   232  	// them, there is nothing to do.
   233  	if countEmptyGroups(as) == len(as) {
   234  		return h
   235  	}
   236  	h2 := h.clone()
   237  	// Pre-format the attributes as an optimization.
   238  	state := h2.newHandleState((*buffer.Buffer)(&h2.preformattedAttrs), false, "")
   239  	defer state.free()
   240  	state.prefix.WriteString(h.groupPrefix)
   241  	if pfa := h2.preformattedAttrs; len(pfa) > 0 {
   242  		state.sep = h.attrSep()
   243  		if h2.json && pfa[len(pfa)-1] == '{' {
   244  			state.sep = ""
   245  		}
   246  	}
   247  	// Remember the position in the buffer, in case all attrs are empty.
   248  	pos := state.buf.Len()
   249  	state.openGroups()
   250  	if !state.appendAttrs(as) {
   251  		state.buf.SetLen(pos)
   252  	} else {
   253  		// Remember the new prefix for later keys.
   254  		h2.groupPrefix = state.prefix.String()
   255  		// Remember how many opened groups are in preformattedAttrs,
   256  		// so we don't open them again when we handle a Record.
   257  		h2.nOpenGroups = len(h2.groups)
   258  	}
   259  	return h2
   260  }
   261  
   262  func (h *commonHandler) withGroup(name string) *commonHandler {
   263  	h2 := h.clone()
   264  	h2.groups = append(h2.groups, name)
   265  	return h2
   266  }
   267  
   268  // handle is the internal implementation of Handler.Handle
   269  // used by TextHandler and JSONHandler.
   270  func (h *commonHandler) handle(r Record) error {
   271  	state := h.newHandleState(buffer.New(), true, "")
   272  	defer state.free()
   273  	if h.json {
   274  		state.buf.WriteByte('{')
   275  	}
   276  	// Built-in attributes. They are not in a group.
   277  	stateGroups := state.groups
   278  	state.groups = nil // So ReplaceAttrs sees no groups instead of the pre groups.
   279  	rep := h.opts.ReplaceAttr
   280  	// time
   281  	if !r.Time.IsZero() {
   282  		key := TimeKey
   283  		val := r.Time.Round(0) // strip monotonic to match Attr behavior
   284  		if rep == nil {
   285  			state.appendKey(key)
   286  			state.appendTime(val)
   287  		} else {
   288  			state.appendAttr(Time(key, val))
   289  		}
   290  	}
   291  	// level
   292  	key := LevelKey
   293  	val := r.Level
   294  	if rep == nil {
   295  		state.appendKey(key)
   296  		state.appendString(val.String())
   297  	} else {
   298  		state.appendAttr(Any(key, val))
   299  	}
   300  	// source
   301  	if h.opts.AddSource {
   302  		state.appendAttr(Any(SourceKey, r.source()))
   303  	}
   304  	key = MessageKey
   305  	msg := r.Message
   306  	if rep == nil {
   307  		state.appendKey(key)
   308  		state.appendString(msg)
   309  	} else {
   310  		state.appendAttr(String(key, msg))
   311  	}
   312  	state.groups = stateGroups // Restore groups passed to ReplaceAttrs.
   313  	state.appendNonBuiltIns(r)
   314  	state.buf.WriteByte('\n')
   315  
   316  	h.mu.Lock()
   317  	defer h.mu.Unlock()
   318  	_, err := h.w.Write(*state.buf)
   319  	return err
   320  }
   321  
   322  func (s *handleState) appendNonBuiltIns(r Record) {
   323  	// preformatted Attrs
   324  	if pfa := s.h.preformattedAttrs; len(pfa) > 0 {
   325  		s.buf.WriteString(s.sep)
   326  		s.buf.Write(pfa)
   327  		s.sep = s.h.attrSep()
   328  		if s.h.json && pfa[len(pfa)-1] == '{' {
   329  			s.sep = ""
   330  		}
   331  	}
   332  	// Attrs in Record -- unlike the built-in ones, they are in groups started
   333  	// from WithGroup.
   334  	// If the record has no Attrs, don't output any groups.
   335  	nOpenGroups := s.h.nOpenGroups
   336  	if r.NumAttrs() > 0 {
   337  		s.prefix.WriteString(s.h.groupPrefix)
   338  		// The group may turn out to be empty even though it has attrs (for
   339  		// example, ReplaceAttr may delete all the attrs).
   340  		// So remember where we are in the buffer, to restore the position
   341  		// later if necessary.
   342  		pos := s.buf.Len()
   343  		s.openGroups()
   344  		nOpenGroups = len(s.h.groups)
   345  		empty := true
   346  		r.Attrs(func(a Attr) bool {
   347  			if s.appendAttr(a) {
   348  				empty = false
   349  			}
   350  			return true
   351  		})
   352  		if empty {
   353  			s.buf.SetLen(pos)
   354  			nOpenGroups = s.h.nOpenGroups
   355  		}
   356  	}
   357  	if s.h.json {
   358  		// Close all open groups.
   359  		for range s.h.groups[:nOpenGroups] {
   360  			s.buf.WriteByte('}')
   361  		}
   362  		// Close the top-level object.
   363  		s.buf.WriteByte('}')
   364  	}
   365  }
   366  
   367  // attrSep returns the separator between attributes.
   368  func (h *commonHandler) attrSep() string {
   369  	if h.json {
   370  		return ","
   371  	}
   372  	return " "
   373  }
   374  
   375  // handleState holds state for a single call to commonHandler.handle.
   376  // The initial value of sep determines whether to emit a separator
   377  // before the next key, after which it stays true.
   378  type handleState struct {
   379  	h       *commonHandler
   380  	buf     *buffer.Buffer
   381  	freeBuf bool           // should buf be freed?
   382  	sep     string         // separator to write before next key
   383  	prefix  *buffer.Buffer // for text: key prefix
   384  	groups  *[]string      // pool-allocated slice of active groups, for ReplaceAttr
   385  }
   386  
   387  var groupPool = sync.Pool{New: func() any {
   388  	s := make([]string, 0, 10)
   389  	return &s
   390  }}
   391  
   392  func (h *commonHandler) newHandleState(buf *buffer.Buffer, freeBuf bool, sep string) handleState {
   393  	s := handleState{
   394  		h:       h,
   395  		buf:     buf,
   396  		freeBuf: freeBuf,
   397  		sep:     sep,
   398  		prefix:  buffer.New(),
   399  	}
   400  	if h.opts.ReplaceAttr != nil {
   401  		s.groups = groupPool.Get().(*[]string)
   402  		*s.groups = append(*s.groups, h.groups[:h.nOpenGroups]...)
   403  	}
   404  	return s
   405  }
   406  
   407  func (s *handleState) free() {
   408  	if s.freeBuf {
   409  		s.buf.Free()
   410  	}
   411  	if gs := s.groups; gs != nil {
   412  		*gs = (*gs)[:0]
   413  		groupPool.Put(gs)
   414  	}
   415  	s.prefix.Free()
   416  }
   417  
   418  func (s *handleState) openGroups() {
   419  	for _, n := range s.h.groups[s.h.nOpenGroups:] {
   420  		s.openGroup(n)
   421  	}
   422  }
   423  
   424  // Separator for group names and keys.
   425  const keyComponentSep = '.'
   426  
   427  // openGroup starts a new group of attributes
   428  // with the given name.
   429  func (s *handleState) openGroup(name string) {
   430  	if s.h.json {
   431  		s.appendKey(name)
   432  		s.buf.WriteByte('{')
   433  		s.sep = ""
   434  	} else {
   435  		s.prefix.WriteString(name)
   436  		s.prefix.WriteByte(keyComponentSep)
   437  	}
   438  	// Collect group names for ReplaceAttr.
   439  	if s.groups != nil {
   440  		*s.groups = append(*s.groups, name)
   441  	}
   442  }
   443  
   444  // closeGroup ends the group with the given name.
   445  func (s *handleState) closeGroup(name string) {
   446  	if s.h.json {
   447  		s.buf.WriteByte('}')
   448  	} else {
   449  		(*s.prefix) = (*s.prefix)[:len(*s.prefix)-len(name)-1 /* for keyComponentSep */]
   450  	}
   451  	s.sep = s.h.attrSep()
   452  	if s.groups != nil {
   453  		*s.groups = (*s.groups)[:len(*s.groups)-1]
   454  	}
   455  }
   456  
   457  // appendAttrs appends the slice of Attrs.
   458  // It reports whether something was appended.
   459  func (s *handleState) appendAttrs(as []Attr) bool {
   460  	nonEmpty := false
   461  	for _, a := range as {
   462  		if s.appendAttr(a) {
   463  			nonEmpty = true
   464  		}
   465  	}
   466  	return nonEmpty
   467  }
   468  
   469  // appendAttr appends the Attr's key and value.
   470  // It handles replacement and checking for an empty key.
   471  // It reports whether something was appended.
   472  func (s *handleState) appendAttr(a Attr) bool {
   473  	a.Value = a.Value.Resolve()
   474  	if rep := s.h.opts.ReplaceAttr; rep != nil && a.Value.Kind() != KindGroup {
   475  		var gs []string
   476  		if s.groups != nil {
   477  			gs = *s.groups
   478  		}
   479  		// a.Value is resolved before calling ReplaceAttr, so the user doesn't have to.
   480  		a = rep(gs, a)
   481  		// The ReplaceAttr function may return an unresolved Attr.
   482  		a.Value = a.Value.Resolve()
   483  	}
   484  	// Elide empty Attrs.
   485  	if a.isEmpty() {
   486  		return false
   487  	}
   488  	// Special case: Source.
   489  	if v := a.Value; v.Kind() == KindAny {
   490  		if src, ok := v.Any().(*Source); ok {
   491  			if s.h.json {
   492  				a.Value = src.group()
   493  			} else {
   494  				a.Value = StringValue(fmt.Sprintf("%s:%d", src.File, src.Line))
   495  			}
   496  		}
   497  	}
   498  	if a.Value.Kind() == KindGroup {
   499  		attrs := a.Value.Group()
   500  		// Output only non-empty groups.
   501  		if len(attrs) > 0 {
   502  			// The group may turn out to be empty even though it has attrs (for
   503  			// example, ReplaceAttr may delete all the attrs).
   504  			// So remember where we are in the buffer, to restore the position
   505  			// later if necessary.
   506  			pos := s.buf.Len()
   507  			// Inline a group with an empty key.
   508  			if a.Key != "" {
   509  				s.openGroup(a.Key)
   510  			}
   511  			if !s.appendAttrs(attrs) {
   512  				s.buf.SetLen(pos)
   513  				return false
   514  			}
   515  			if a.Key != "" {
   516  				s.closeGroup(a.Key)
   517  			}
   518  		}
   519  	} else {
   520  		s.appendKey(a.Key)
   521  		s.appendValue(a.Value)
   522  	}
   523  	return true
   524  }
   525  
   526  func (s *handleState) appendError(err error) {
   527  	s.appendString(fmt.Sprintf("!ERROR:%v", err))
   528  }
   529  
   530  func (s *handleState) appendKey(key string) {
   531  	s.buf.WriteString(s.sep)
   532  	if s.prefix != nil && len(*s.prefix) > 0 {
   533  		s.appendTwoStrings(string(*s.prefix), key)
   534  	} else {
   535  		s.appendString(key)
   536  	}
   537  	if s.h.json {
   538  		s.buf.WriteByte(':')
   539  	} else {
   540  		s.buf.WriteByte('=')
   541  	}
   542  	s.sep = s.h.attrSep()
   543  }
   544  
   545  // appendTwoStrings implements appendString(prefix + key), but faster.
   546  func (s *handleState) appendTwoStrings(x, y string) {
   547  	buf := *s.buf
   548  	switch {
   549  	case s.h.json:
   550  		buf.WriteByte('"')
   551  		buf = appendEscapedJSONString(buf, x)
   552  		buf = appendEscapedJSONString(buf, y)
   553  		buf.WriteByte('"')
   554  	case !needsQuoting(x) && !needsQuoting(y):
   555  		buf.WriteString(x)
   556  		buf.WriteString(y)
   557  	default:
   558  		buf = strconv.AppendQuote(buf, x+y)
   559  	}
   560  	*s.buf = buf
   561  }
   562  
   563  func (s *handleState) appendString(str string) {
   564  	if s.h.json {
   565  		s.buf.WriteByte('"')
   566  		*s.buf = appendEscapedJSONString(*s.buf, str)
   567  		s.buf.WriteByte('"')
   568  	} else {
   569  		// text
   570  		if needsQuoting(str) {
   571  			*s.buf = strconv.AppendQuote(*s.buf, str)
   572  		} else {
   573  			s.buf.WriteString(str)
   574  		}
   575  	}
   576  }
   577  
   578  func (s *handleState) appendValue(v Value) {
   579  	defer func() {
   580  		if r := recover(); r != nil {
   581  			// If it panics with a nil pointer, the most likely cases are
   582  			// an encoding.TextMarshaler or error fails to guard against nil,
   583  			// in which case "<nil>" seems to be the feasible choice.
   584  			//
   585  			// Adapted from the code in fmt/print.go.
   586  			if v := reflect.ValueOf(v.any); v.Kind() == reflect.Pointer && v.IsNil() {
   587  				s.appendString("<nil>")
   588  				return
   589  			}
   590  
   591  			// Otherwise just print the original panic message.
   592  			s.appendString(fmt.Sprintf("!PANIC: %v", r))
   593  		}
   594  	}()
   595  
   596  	var err error
   597  	if s.h.json {
   598  		err = appendJSONValue(s, v)
   599  	} else {
   600  		err = appendTextValue(s, v)
   601  	}
   602  	if err != nil {
   603  		s.appendError(err)
   604  	}
   605  }
   606  
   607  func (s *handleState) appendTime(t time.Time) {
   608  	if s.h.json {
   609  		appendJSONTime(s, t)
   610  	} else {
   611  		*s.buf = appendRFC3339Millis(*s.buf, t)
   612  	}
   613  }
   614  
   615  func appendRFC3339Millis(b []byte, t time.Time) []byte {
   616  	// Format according to time.RFC3339Nano since it is highly optimized,
   617  	// but truncate it to use millisecond resolution.
   618  	// Unfortunately, that format trims trailing 0s, so add 1/10 millisecond
   619  	// to guarantee that there are exactly 4 digits after the period.
   620  	const prefixLen = len("2006-01-02T15:04:05.000")
   621  	n := len(b)
   622  	t = t.Truncate(time.Millisecond).Add(time.Millisecond / 10)
   623  	b = t.AppendFormat(b, time.RFC3339Nano)
   624  	b = append(b[:n+prefixLen], b[n+prefixLen+1:]...) // drop the 4th digit
   625  	return b
   626  }
   627  
   628  // DiscardHandler discards all log output.
   629  // DiscardHandler.Enabled returns false for all Levels.
   630  var DiscardHandler Handler = discardHandler{}
   631  
   632  type discardHandler struct{}
   633  
   634  func (dh discardHandler) Enabled(context.Context, Level) bool  { return false }
   635  func (dh discardHandler) Handle(context.Context, Record) error { return nil }
   636  func (dh discardHandler) WithAttrs(attrs []Attr) Handler       { return dh }
   637  func (dh discardHandler) WithGroup(name string) Handler        { return dh }
   638  

View as plain text