File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ //go:build go1.22
2+ // +build go1.22
3+
4+ package log
5+
6+ import (
7+ "encoding/base64"
8+ )
9+
10+ // Base64 adds base64 encoding of the value to the entry.
11+ func (e * Entry ) Base64 (key string , value []byte ) * Entry {
12+ if e == nil {
13+ return nil
14+ }
15+
16+ e .buf = append (e .buf , ',' , '"' )
17+ e .buf = append (e .buf , key ... )
18+ e .buf = append (e .buf , '"' , ':' , '"' )
19+ e .buf = base64 .StdEncoding .AppendEncode (e .buf , value )
20+ e .buf = append (e .buf , '"' )
21+ return e
22+ }
23+
24+ // Base64URL adds base64 encoding of the value to the entry.
25+ func (e * Entry ) Base64URL (key string , value []byte ) * Entry {
26+ if e == nil {
27+ return nil
28+ }
29+
30+ e .buf = append (e .buf , ',' , '"' )
31+ e .buf = append (e .buf , key ... )
32+ e .buf = append (e .buf , '"' , ':' , '"' )
33+ e .buf = base64 .URLEncoding .AppendEncode (e .buf , value )
34+ e .buf = append (e .buf , '"' )
35+ return e
36+ }
You can’t perform that action at this time.
0 commit comments