mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 14:42:26 -05:00 
			
		
		
		
	[chore] update otel -> v1.20.0 (#2358)
This commit is contained in:
		
					parent
					
						
							
								deaea100c3
							
						
					
				
			
			
				commit
				
					
						7753f42132
					
				
			
		
					 422 changed files with 1814 additions and 6590 deletions
				
			
		
							
								
								
									
										48
									
								
								vendor/github.com/go-logr/logr/funcr/funcr.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										48
									
								
								vendor/github.com/go-logr/logr/funcr/funcr.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -116,17 +116,17 @@ type Options struct { | |||
| 	// Equivalent hooks are offered for key-value pairs saved via | ||||
| 	// logr.Logger.WithValues or Formatter.AddValues (see RenderValuesHook) and | ||||
| 	// for user-provided pairs (see RenderArgsHook). | ||||
| 	RenderBuiltinsHook func(kvList []interface{}) []interface{} | ||||
| 	RenderBuiltinsHook func(kvList []any) []any | ||||
| 
 | ||||
| 	// RenderValuesHook is the same as RenderBuiltinsHook, except that it is | ||||
| 	// only called for key-value pairs saved via logr.Logger.WithValues.  See | ||||
| 	// RenderBuiltinsHook for more details. | ||||
| 	RenderValuesHook func(kvList []interface{}) []interface{} | ||||
| 	RenderValuesHook func(kvList []any) []any | ||||
| 
 | ||||
| 	// RenderArgsHook is the same as RenderBuiltinsHook, except that it is only | ||||
| 	// called for key-value pairs passed directly to Info and Error.  See | ||||
| 	// RenderBuiltinsHook for more details. | ||||
| 	RenderArgsHook func(kvList []interface{}) []interface{} | ||||
| 	RenderArgsHook func(kvList []any) []any | ||||
| 
 | ||||
| 	// MaxLogDepth tells funcr how many levels of nested fields (e.g. a struct | ||||
| 	// that contains a struct, etc.) it may log.  Every time it finds a struct, | ||||
|  | @ -163,7 +163,7 @@ func (l fnlogger) WithName(name string) logr.LogSink { | |||
| 	return &l | ||||
| } | ||||
| 
 | ||||
| func (l fnlogger) WithValues(kvList ...interface{}) logr.LogSink { | ||||
| func (l fnlogger) WithValues(kvList ...any) logr.LogSink { | ||||
| 	l.Formatter.AddValues(kvList) | ||||
| 	return &l | ||||
| } | ||||
|  | @ -173,12 +173,12 @@ func (l fnlogger) WithCallDepth(depth int) logr.LogSink { | |||
| 	return &l | ||||
| } | ||||
| 
 | ||||
| func (l fnlogger) Info(level int, msg string, kvList ...interface{}) { | ||||
| func (l fnlogger) Info(level int, msg string, kvList ...any) { | ||||
| 	prefix, args := l.FormatInfo(level, msg, kvList) | ||||
| 	l.write(prefix, args) | ||||
| } | ||||
| 
 | ||||
| func (l fnlogger) Error(err error, msg string, kvList ...interface{}) { | ||||
| func (l fnlogger) Error(err error, msg string, kvList ...any) { | ||||
| 	prefix, args := l.FormatError(err, msg, kvList) | ||||
| 	l.write(prefix, args) | ||||
| } | ||||
|  | @ -229,7 +229,7 @@ func newFormatter(opts Options, outfmt outputFormat) Formatter { | |||
| type Formatter struct { | ||||
| 	outputFormat outputFormat | ||||
| 	prefix       string | ||||
| 	values       []interface{} | ||||
| 	values       []any | ||||
| 	valuesStr    string | ||||
| 	depth        int | ||||
| 	opts         *Options | ||||
|  | @ -246,10 +246,10 @@ const ( | |||
| ) | ||||
| 
 | ||||
| // PseudoStruct is a list of key-value pairs that gets logged as a struct. | ||||
| type PseudoStruct []interface{} | ||||
| type PseudoStruct []any | ||||
| 
 | ||||
| // render produces a log line, ready to use. | ||||
| func (f Formatter) render(builtins, args []interface{}) string { | ||||
| func (f Formatter) render(builtins, args []any) string { | ||||
| 	// Empirically bytes.Buffer is faster than strings.Builder for this. | ||||
| 	buf := bytes.NewBuffer(make([]byte, 0, 1024)) | ||||
| 	if f.outputFormat == outputJSON { | ||||
|  | @ -292,7 +292,7 @@ func (f Formatter) render(builtins, args []interface{}) string { | |||
| // This function returns a potentially modified version of kvList, which | ||||
| // ensures that there is a value for every key (adding a value if needed) and | ||||
| // that each key is a string (substituting a key if needed). | ||||
| func (f Formatter) flatten(buf *bytes.Buffer, kvList []interface{}, continuing bool, escapeKeys bool) []interface{} { | ||||
| func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, continuing bool, escapeKeys bool) []any { | ||||
| 	// This logic overlaps with sanitize() but saves one type-cast per key, | ||||
| 	// which can be measurable. | ||||
| 	if len(kvList)%2 != 0 { | ||||
|  | @ -334,7 +334,7 @@ func (f Formatter) flatten(buf *bytes.Buffer, kvList []interface{}, continuing b | |||
| 	return kvList | ||||
| } | ||||
| 
 | ||||
| func (f Formatter) pretty(value interface{}) string { | ||||
| func (f Formatter) pretty(value any) string { | ||||
| 	return f.prettyWithFlags(value, 0, 0) | ||||
| } | ||||
| 
 | ||||
|  | @ -343,7 +343,7 @@ const ( | |||
| ) | ||||
| 
 | ||||
| // TODO: This is not fast. Most of the overhead goes here. | ||||
| func (f Formatter) prettyWithFlags(value interface{}, flags uint32, depth int) string { | ||||
| func (f Formatter) prettyWithFlags(value any, flags uint32, depth int) string { | ||||
| 	if depth > f.opts.MaxLogDepth { | ||||
| 		return `"<max-log-depth-exceeded>"` | ||||
| 	} | ||||
|  | @ -614,7 +614,7 @@ func isEmpty(v reflect.Value) bool { | |||
| 	return false | ||||
| } | ||||
| 
 | ||||
| func invokeMarshaler(m logr.Marshaler) (ret interface{}) { | ||||
| func invokeMarshaler(m logr.Marshaler) (ret any) { | ||||
| 	defer func() { | ||||
| 		if r := recover(); r != nil { | ||||
| 			ret = fmt.Sprintf("<panic: %s>", r) | ||||
|  | @ -675,12 +675,12 @@ func (f Formatter) caller() Caller { | |||
| 
 | ||||
| const noValue = "<no-value>" | ||||
| 
 | ||||
| func (f Formatter) nonStringKey(v interface{}) string { | ||||
| func (f Formatter) nonStringKey(v any) string { | ||||
| 	return fmt.Sprintf("<non-string-key: %s>", f.snippet(v)) | ||||
| } | ||||
| 
 | ||||
| // snippet produces a short snippet string of an arbitrary value. | ||||
| func (f Formatter) snippet(v interface{}) string { | ||||
| func (f Formatter) snippet(v any) string { | ||||
| 	const snipLen = 16 | ||||
| 
 | ||||
| 	snip := f.pretty(v) | ||||
|  | @ -693,7 +693,7 @@ func (f Formatter) snippet(v interface{}) string { | |||
| // sanitize ensures that a list of key-value pairs has a value for every key | ||||
| // (adding a value if needed) and that each key is a string (substituting a key | ||||
| // if needed). | ||||
| func (f Formatter) sanitize(kvList []interface{}) []interface{} { | ||||
| func (f Formatter) sanitize(kvList []any) []any { | ||||
| 	if len(kvList)%2 != 0 { | ||||
| 		kvList = append(kvList, noValue) | ||||
| 	} | ||||
|  | @ -727,8 +727,8 @@ func (f Formatter) GetDepth() int { | |||
| // FormatInfo renders an Info log message into strings.  The prefix will be | ||||
| // empty when no names were set (via AddNames), or when the output is | ||||
| // configured for JSON. | ||||
| func (f Formatter) FormatInfo(level int, msg string, kvList []interface{}) (prefix, argsStr string) { | ||||
| 	args := make([]interface{}, 0, 64) // using a constant here impacts perf | ||||
| func (f Formatter) FormatInfo(level int, msg string, kvList []any) (prefix, argsStr string) { | ||||
| 	args := make([]any, 0, 64) // using a constant here impacts perf | ||||
| 	prefix = f.prefix | ||||
| 	if f.outputFormat == outputJSON { | ||||
| 		args = append(args, "logger", prefix) | ||||
|  | @ -745,10 +745,10 @@ func (f Formatter) FormatInfo(level int, msg string, kvList []interface{}) (pref | |||
| } | ||||
| 
 | ||||
| // FormatError renders an Error log message into strings.  The prefix will be | ||||
| // empty when no names were set (via AddNames),  or when the output is | ||||
| // empty when no names were set (via AddNames), or when the output is | ||||
| // configured for JSON. | ||||
| func (f Formatter) FormatError(err error, msg string, kvList []interface{}) (prefix, argsStr string) { | ||||
| 	args := make([]interface{}, 0, 64) // using a constant here impacts perf | ||||
| func (f Formatter) FormatError(err error, msg string, kvList []any) (prefix, argsStr string) { | ||||
| 	args := make([]any, 0, 64) // using a constant here impacts perf | ||||
| 	prefix = f.prefix | ||||
| 	if f.outputFormat == outputJSON { | ||||
| 		args = append(args, "logger", prefix) | ||||
|  | @ -761,12 +761,12 @@ func (f Formatter) FormatError(err error, msg string, kvList []interface{}) (pre | |||
| 		args = append(args, "caller", f.caller()) | ||||
| 	} | ||||
| 	args = append(args, "msg", msg) | ||||
| 	var loggableErr interface{} | ||||
| 	var loggableErr any | ||||
| 	if err != nil { | ||||
| 		loggableErr = err.Error() | ||||
| 	} | ||||
| 	args = append(args, "error", loggableErr) | ||||
| 	return f.prefix, f.render(args, kvList) | ||||
| 	return prefix, f.render(args, kvList) | ||||
| } | ||||
| 
 | ||||
| // AddName appends the specified name.  funcr uses '/' characters to separate | ||||
|  | @ -781,7 +781,7 @@ func (f *Formatter) AddName(name string) { | |||
| 
 | ||||
| // AddValues adds key-value pairs to the set of saved values to be logged with | ||||
| // each log line. | ||||
| func (f *Formatter) AddValues(kvList []interface{}) { | ||||
| func (f *Formatter) AddValues(kvList []any) { | ||||
| 	// Three slice args forces a copy. | ||||
| 	n := len(f.values) | ||||
| 	f.values = append(f.values[:n:n], kvList...) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue