Skip to content

Commit 6ba25cf

Browse files
committed
fix: add simplify slice type
1 parent 8c683d0 commit 6ba25cf

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

log/simplify.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package log
2+
3+
const (
4+
slicePrintLen = 30
5+
)
6+
7+
type Slice[T any] []T
8+
9+
func (s Slice[T]) Format() any {
10+
if len(s) >= slicePrintLen {
11+
return s[0:slicePrintLen]
12+
}
13+
return s
14+
}

0 commit comments

Comments
 (0)