code: func configureLogging(ctx context.Context, config *configuration.Configuration) (context.Context, error) {
  	log.SetLevel(logLevel(config.Log.Level))
  
  	formatter := config.Log.Formatter
  	if formatter == "" {
  		formatter = "text" // default formatter
  	}
  
  	switch formatter {
  	case "json":
  		log.SetFormatter(&log.JSONFormatter{
  			TimestampFormat: time.RFC3339Nano,
  		})
  	case "text":
  		log.SetFormatter(&log.TextFormatter{
  			TimestampFormat: time.RFC3339Nano,
  		})
  	case "logstash":
  		log.SetFormatter(&logstash.LogstashFormatter{
  			TimestampFormat: time.RFC3339Nano,
  		})
  	default:
  		// just let the library use default on empty string.
  		if config.Log.Formatter != "" {
  			return ctx, fmt.Errorf("unsupported logging formatter: %q", config.Log.Formatter)
  		}
  	}
  
  	if config.Log.Formatter != "" {
  		log.Debugf("using %q logging formatter", config.Log.Formatter)
  	}
  
  	if len(config.Log.Fields) > 0 {
  		// build up the static fields, if present.
  		var fields []interface{}
  		for k := range config.Log.Fields {
  			fields = append(fields, k)
  		}
  
  		ctx = dcontext.WithValues(ctx, config.Log.Fields)
  		ctx = dcontext.WithLogger(ctx, dcontext.GetLogger(ctx, fields...))
  	}
  
  	return ctx, nil
  }
docs: // configureLogging prepares the context with a logger using the
  // configuration.