@@ -1060,9 +1060,9 @@ func (e *Entry) AnErr(key string, err error) *Entry {
10601060 e .buf = append (e .buf , '"' )
10611061 s := err .Error ()
10621062 if ! hasSIMDEscape || len (s ) <= simdEscapeThreshold {
1063- e .buf = appendString (e .buf , s )
1063+ e .buf = appendLoggerString (e .buf , s )
10641064 } else {
1065- e .buf = appendString2 (e .buf , s )
1065+ e .buf = appendLoggerString2 (e .buf , s )
10661066 }
10671067 e .buf = append (e .buf , '"' )
10681068 }
@@ -1088,9 +1088,9 @@ func (e *Entry) Errs(key string, errs []error) *Entry {
10881088 e .buf = append (e .buf , '"' )
10891089 s := err .Error ()
10901090 if ! hasSIMDEscape || len (s ) <= simdEscapeThreshold {
1091- e .buf = appendString (e .buf , s )
1091+ e .buf = appendLoggerString (e .buf , s )
10921092 } else {
1093- e .buf = appendString2 (e .buf , s )
1093+ e .buf = appendLoggerString2 (e .buf , s )
10941094 }
10951095 e .buf = append (e .buf , '"' )
10961096 }
@@ -1562,9 +1562,9 @@ func (e *Entry) Str(key string, val string) *Entry {
15621562 buf = append (buf , key ... )
15631563 buf = append (buf , '"' , ':' , '"' )
15641564 if ! hasSIMDEscape || len (val ) <= simdEscapeThreshold {
1565- buf = appendString (buf , val )
1565+ buf = appendLoggerString (buf , val )
15661566 } else {
1567- buf = appendString2 (buf , val )
1567+ buf = appendLoggerString2 (buf , val )
15681568 }
15691569 buf = append (buf , '"' )
15701570 e .buf = buf
@@ -1598,9 +1598,9 @@ func (e *Entry) Stringer(key string, val fmt.Stringer) *Entry {
15981598 e .buf = append (e .buf , '"' )
15991599 s := val .String ()
16001600 if ! hasSIMDEscape || len (s ) <= simdEscapeThreshold {
1601- e .buf = appendString (e .buf , s )
1601+ e .buf = appendLoggerString (e .buf , s )
16021602 } else {
1603- e .buf = appendString2 (e .buf , s )
1603+ e .buf = appendLoggerString2 (e .buf , s )
16041604 }
16051605 e .buf = append (e .buf , '"' )
16061606 } else {
@@ -1622,9 +1622,9 @@ func (e *Entry) GoStringer(key string, val fmt.GoStringer) *Entry {
16221622 e .buf = append (e .buf , '"' )
16231623 s := val .GoString ()
16241624 if ! hasSIMDEscape || len (s ) <= simdEscapeThreshold {
1625- e .buf = appendString (e .buf , s )
1625+ e .buf = appendLoggerString (e .buf , s )
16261626 } else {
1627- e .buf = appendString2 (e .buf , s )
1627+ e .buf = appendLoggerString2 (e .buf , s )
16281628 }
16291629 e .buf = append (e .buf , '"' )
16301630 } else {
@@ -1648,9 +1648,9 @@ func (e *Entry) Strs(key string, vals []string) *Entry {
16481648 }
16491649 e .buf = append (e .buf , '"' )
16501650 if ! hasSIMDEscape || len (val ) <= simdEscapeThreshold {
1651- e .buf = appendString (e .buf , val )
1651+ e .buf = appendLoggerString (e .buf , val )
16521652 } else {
1653- e .buf = appendString2 (e .buf , val )
1653+ e .buf = appendLoggerString2 (e .buf , val )
16541654 }
16551655 e .buf = append (e .buf , '"' )
16561656 }
@@ -1705,9 +1705,9 @@ func (e *Entry) Bytes(key string, val []byte) *Entry {
17051705 buf = append (buf , key ... )
17061706 buf = append (buf , '"' , ':' , '"' )
17071707 if ! hasSIMDEscape || len (val ) <= simdEscapeThreshold {
1708- buf = appendBytes (buf , val )
1708+ buf = appendLoggerBytes (buf , val )
17091709 } else {
1710- buf = appendBytes2 (buf , val )
1710+ buf = appendLoggerBytes2 (buf , val )
17111711 }
17121712 buf = append (buf , '"' )
17131713 e .buf = buf
@@ -1728,9 +1728,9 @@ func (e *Entry) BytesOrNil(key string, val []byte) *Entry {
17281728 } else {
17291729 e .buf = append (e .buf , '"' )
17301730 if ! hasSIMDEscape || len (val ) <= simdEscapeThreshold {
1731- e .buf = appendBytes (e .buf , val )
1731+ e .buf = appendLoggerBytes (e .buf , val )
17321732 } else {
1733- e .buf = appendBytes2 (e .buf , val )
1733+ e .buf = appendLoggerBytes2 (e .buf , val )
17341734 }
17351735 e .buf = append (e .buf , '"' )
17361736 }
@@ -1996,9 +1996,9 @@ func (e *Entry) Stack() *Entry {
19961996 e .buf = append (e .buf , "\" :\" " ... )
19971997 b := stacks (false )
19981998 if ! hasSIMDEscape || len (b ) <= simdEscapeThreshold {
1999- e .buf = appendBytes (e .buf , b )
1999+ e .buf = appendLoggerBytes (e .buf , b )
20002000 } else {
2001- e .buf = appendBytes2 (e .buf , b )
2001+ e .buf = appendLoggerBytes2 (e .buf , b )
20022002 }
20032003 e .buf = append (e .buf , '"' )
20042004 return e
@@ -2055,9 +2055,9 @@ func (e *Entry) Msg(msg string) {
20552055 e .buf = append (e .buf , MessageKey ... )
20562056 e .buf = append (e .buf , "\" :\" " ... )
20572057 if ! hasSIMDEscape || len (msg ) <= simdEscapeThreshold {
2058- e .buf = appendString (e .buf , msg )
2058+ e .buf = appendLoggerString (e .buf , msg )
20592059 } else {
2060- e .buf = appendString2 (e .buf , msg )
2060+ e .buf = appendLoggerString2 (e .buf , msg )
20612061 }
20622062 e .buf = append (e .buf , "\" }\n " ... )
20632063 } else {
@@ -2121,9 +2121,9 @@ func (e *Entry) Msgf(format string, v ...any) {
21212121 e .buf = append (e .buf , "\" :\" " ... )
21222122 fmt .Fprintf (b , format , v ... )
21232123 if ! hasSIMDEscape || len (b .B ) <= simdEscapeThreshold {
2124- e .buf = appendBytes (e .buf , b .B )
2124+ e .buf = appendLoggerBytes (e .buf , b .B )
21252125 } else {
2126- e .buf = appendBytes2 (e .buf , b .B )
2126+ e .buf = appendLoggerBytes2 (e .buf , b .B )
21272127 }
21282128 e .buf = append (e .buf , '"' )
21292129 if cap (b .B ) <= bbcap {
@@ -2145,9 +2145,9 @@ func (e *Entry) Msgs(args ...any) {
21452145 e .buf = append (e .buf , "\" :\" " ... )
21462146 fmt .Fprint (b , args ... )
21472147 if ! hasSIMDEscape || len (b .B ) <= simdEscapeThreshold {
2148- e .buf = appendBytes (e .buf , b .B )
2148+ e .buf = appendLoggerBytes (e .buf , b .B )
21492149 } else {
2150- e .buf = appendBytes2 (e .buf , b .B )
2150+ e .buf = appendLoggerBytes2 (e .buf , b .B )
21512151 }
21522152 e .buf = append (e .buf , '"' )
21532153 if cap (b .B ) <= bbcap {
@@ -2227,9 +2227,9 @@ func (e *Entry) Interface(key string, i any) *Entry {
22272227 fmt .Fprintf (b , `marshaling error: %+v` , err )
22282228 e .buf = append (e .buf , '"' )
22292229 if ! hasSIMDEscape || len (b .B ) <= simdEscapeThreshold {
2230- e .buf = appendBytes (e .buf , b .B )
2230+ e .buf = appendLoggerBytes (e .buf , b .B )
22312231 } else {
2232- e .buf = appendBytes2 (e .buf , b .B )
2232+ e .buf = appendLoggerBytes2 (e .buf , b .B )
22332233 }
22342234 e .buf = append (e .buf , '"' )
22352235 } else {
@@ -2421,9 +2421,9 @@ func (e *Entry) Any(key string, value any) *Entry {
24212421 fmt .Fprintf (b , `%+v` , value )
24222422 e .buf = append (e .buf , '"' )
24232423 if ! hasSIMDEscape || len (b .B ) <= simdEscapeThreshold {
2424- e .buf = appendBytes (e .buf , b .B )
2424+ e .buf = appendLoggerBytes (e .buf , b .B )
24252425 } else {
2426- e .buf = appendBytes2 (e .buf , b .B )
2426+ e .buf = appendLoggerBytes2 (e .buf , b .B )
24272427 }
24282428 e .buf = append (e .buf , '"' )
24292429 } else {
@@ -2581,3 +2581,5 @@ func wlprintf(w Writer, level Level, format string, args ...any) (int, error) {
25812581//go:noescape
25822582//go:linkname now time.now
25832583func now () (sec int64 , nsec int32 , mono int64 )
2584+
2585+ func b2s (b []byte ) string { return * (* string )(unsafe .Pointer (& b )) }
0 commit comments