mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 16:02:25 -05:00
update dependencies
This commit is contained in:
parent
18047de666
commit
6f5ccf4355
55 changed files with 5674 additions and 1905 deletions
27
vendor/codeberg.org/gruf/go-errors/data.go
generated
vendored
27
vendor/codeberg.org/gruf/go-errors/data.go
generated
vendored
|
|
@ -4,17 +4,9 @@ import (
|
|||
"fmt"
|
||||
"sync"
|
||||
|
||||
"codeberg.org/gruf/go-bytes"
|
||||
"codeberg.org/gruf/go-logger"
|
||||
"codeberg.org/gruf/go-format"
|
||||
)
|
||||
|
||||
// global logfmt data formatter.
|
||||
var logfmt = logger.TextFormat{
|
||||
Strict: false,
|
||||
Verbose: true,
|
||||
MaxDepth: 5,
|
||||
}
|
||||
|
||||
// KV is a structure for setting key-value pairs in ErrorData.
|
||||
type KV struct {
|
||||
Key string
|
||||
|
|
@ -31,7 +23,7 @@ type ErrorData interface {
|
|||
Append(...KV)
|
||||
|
||||
// Implement byte slice representation formatter.
|
||||
logger.Formattable
|
||||
format.Formattable
|
||||
|
||||
// Implement string representation formatter.
|
||||
fmt.Stringer
|
||||
|
|
@ -89,13 +81,22 @@ func (d *errorData) Append(kvs ...KV) {
|
|||
}
|
||||
|
||||
func (d *errorData) AppendFormat(b []byte) []byte {
|
||||
buf := bytes.Buffer{B: b}
|
||||
buf := format.Buffer{B: b}
|
||||
d.mu.Lock()
|
||||
buf.B = append(buf.B, '{')
|
||||
|
||||
// Append data as kv pairs
|
||||
for i := range d.data {
|
||||
logfmt.AppendKey(&buf, d.data[i].Key)
|
||||
logfmt.AppendValue(&buf, d.data[i].Value)
|
||||
key := d.data[i].Key
|
||||
val := d.data[i].Value
|
||||
format.Appendf(&buf, "{:k}={:v} ", key, val)
|
||||
}
|
||||
|
||||
// Drop trailing space
|
||||
if len(d.data) > 0 {
|
||||
buf.Truncate(1)
|
||||
}
|
||||
|
||||
buf.B = append(buf.B, '}')
|
||||
d.mu.Unlock()
|
||||
return buf.B
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue