id
int32 0
167k
| repo
stringlengths 5
54
| path
stringlengths 4
155
| func_name
stringlengths 1
118
| original_string
stringlengths 52
85.5k
| language
stringclasses 1
value | code
stringlengths 52
85.5k
| code_tokens
sequencelengths 21
1.41k
| docstring
stringlengths 6
2.61k
| docstring_tokens
sequencelengths 3
215
| sha
stringlengths 40
40
| url
stringlengths 85
252
|
---|---|---|---|---|---|---|---|---|---|---|---|
147,300 | rs/zerolog | internal/json/types.go | AppendInts16 | func (Encoder) AppendInts16(dst []byte, vals []int16) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendInt(dst, int64(vals[0]), 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendInt(append(dst, ','), int64(val), 10)
}
}
dst = append(dst, ']')
return dst
} | go | func (Encoder) AppendInts16(dst []byte, vals []int16) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendInt(dst, int64(vals[0]), 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendInt(append(dst, ','), int64(val), 10)
}
}
dst = append(dst, ']')
return dst
} | [
"func",
"(",
"Encoder",
")",
"AppendInts16",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"int16",
")",
"[",
"]",
"byte",
"{",
"if",
"len",
"(",
"vals",
")",
"==",
"0",
"{",
"return",
"append",
"(",
"dst",
",",
"'['",
",",
"']'",
")",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"'['",
")",
"\n",
"dst",
"=",
"strconv",
".",
"AppendInt",
"(",
"dst",
",",
"int64",
"(",
"vals",
"[",
"0",
"]",
")",
",",
"10",
")",
"\n",
"if",
"len",
"(",
"vals",
")",
">",
"1",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"vals",
"[",
"1",
":",
"]",
"{",
"dst",
"=",
"strconv",
".",
"AppendInt",
"(",
"append",
"(",
"dst",
",",
"','",
")",
",",
"int64",
"(",
"val",
")",
",",
"10",
")",
"\n",
"}",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"']'",
")",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendInts16 encodes the input int16s to json and
// appends the encoded string list to the input byte slice. | [
"AppendInts16",
"encodes",
"the",
"input",
"int16s",
"to",
"json",
"and",
"appends",
"the",
"encoded",
"string",
"list",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L126-L139 |
147,301 | rs/zerolog | internal/json/types.go | AppendInt32 | func (Encoder) AppendInt32(dst []byte, val int32) []byte {
return strconv.AppendInt(dst, int64(val), 10)
} | go | func (Encoder) AppendInt32(dst []byte, val int32) []byte {
return strconv.AppendInt(dst, int64(val), 10)
} | [
"func",
"(",
"Encoder",
")",
"AppendInt32",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"int32",
")",
"[",
"]",
"byte",
"{",
"return",
"strconv",
".",
"AppendInt",
"(",
"dst",
",",
"int64",
"(",
"val",
")",
",",
"10",
")",
"\n",
"}"
] | // AppendInt32 converts the input int32 to a string and
// appends the encoded string to the input byte slice. | [
"AppendInt32",
"converts",
"the",
"input",
"int32",
"to",
"a",
"string",
"and",
"appends",
"the",
"encoded",
"string",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L143-L145 |
147,302 | rs/zerolog | internal/json/types.go | AppendInts32 | func (Encoder) AppendInts32(dst []byte, vals []int32) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendInt(dst, int64(vals[0]), 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendInt(append(dst, ','), int64(val), 10)
}
}
dst = append(dst, ']')
return dst
} | go | func (Encoder) AppendInts32(dst []byte, vals []int32) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendInt(dst, int64(vals[0]), 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendInt(append(dst, ','), int64(val), 10)
}
}
dst = append(dst, ']')
return dst
} | [
"func",
"(",
"Encoder",
")",
"AppendInts32",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"int32",
")",
"[",
"]",
"byte",
"{",
"if",
"len",
"(",
"vals",
")",
"==",
"0",
"{",
"return",
"append",
"(",
"dst",
",",
"'['",
",",
"']'",
")",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"'['",
")",
"\n",
"dst",
"=",
"strconv",
".",
"AppendInt",
"(",
"dst",
",",
"int64",
"(",
"vals",
"[",
"0",
"]",
")",
",",
"10",
")",
"\n",
"if",
"len",
"(",
"vals",
")",
">",
"1",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"vals",
"[",
"1",
":",
"]",
"{",
"dst",
"=",
"strconv",
".",
"AppendInt",
"(",
"append",
"(",
"dst",
",",
"','",
")",
",",
"int64",
"(",
"val",
")",
",",
"10",
")",
"\n",
"}",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"']'",
")",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendInts32 encodes the input int32s to json and
// appends the encoded string list to the input byte slice. | [
"AppendInts32",
"encodes",
"the",
"input",
"int32s",
"to",
"json",
"and",
"appends",
"the",
"encoded",
"string",
"list",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L149-L162 |
147,303 | rs/zerolog | internal/json/types.go | AppendInt64 | func (Encoder) AppendInt64(dst []byte, val int64) []byte {
return strconv.AppendInt(dst, val, 10)
} | go | func (Encoder) AppendInt64(dst []byte, val int64) []byte {
return strconv.AppendInt(dst, val, 10)
} | [
"func",
"(",
"Encoder",
")",
"AppendInt64",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"int64",
")",
"[",
"]",
"byte",
"{",
"return",
"strconv",
".",
"AppendInt",
"(",
"dst",
",",
"val",
",",
"10",
")",
"\n",
"}"
] | // AppendInt64 converts the input int64 to a string and
// appends the encoded string to the input byte slice. | [
"AppendInt64",
"converts",
"the",
"input",
"int64",
"to",
"a",
"string",
"and",
"appends",
"the",
"encoded",
"string",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L166-L168 |
147,304 | rs/zerolog | internal/json/types.go | AppendInts64 | func (Encoder) AppendInts64(dst []byte, vals []int64) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendInt(dst, vals[0], 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendInt(append(dst, ','), val, 10)
}
}
dst = append(dst, ']')
return dst
} | go | func (Encoder) AppendInts64(dst []byte, vals []int64) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendInt(dst, vals[0], 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendInt(append(dst, ','), val, 10)
}
}
dst = append(dst, ']')
return dst
} | [
"func",
"(",
"Encoder",
")",
"AppendInts64",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"int64",
")",
"[",
"]",
"byte",
"{",
"if",
"len",
"(",
"vals",
")",
"==",
"0",
"{",
"return",
"append",
"(",
"dst",
",",
"'['",
",",
"']'",
")",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"'['",
")",
"\n",
"dst",
"=",
"strconv",
".",
"AppendInt",
"(",
"dst",
",",
"vals",
"[",
"0",
"]",
",",
"10",
")",
"\n",
"if",
"len",
"(",
"vals",
")",
">",
"1",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"vals",
"[",
"1",
":",
"]",
"{",
"dst",
"=",
"strconv",
".",
"AppendInt",
"(",
"append",
"(",
"dst",
",",
"','",
")",
",",
"val",
",",
"10",
")",
"\n",
"}",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"']'",
")",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendInts64 encodes the input int64s to json and
// appends the encoded string list to the input byte slice. | [
"AppendInts64",
"encodes",
"the",
"input",
"int64s",
"to",
"json",
"and",
"appends",
"the",
"encoded",
"string",
"list",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L172-L185 |
147,305 | rs/zerolog | internal/json/types.go | AppendUint | func (Encoder) AppendUint(dst []byte, val uint) []byte {
return strconv.AppendUint(dst, uint64(val), 10)
} | go | func (Encoder) AppendUint(dst []byte, val uint) []byte {
return strconv.AppendUint(dst, uint64(val), 10)
} | [
"func",
"(",
"Encoder",
")",
"AppendUint",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"uint",
")",
"[",
"]",
"byte",
"{",
"return",
"strconv",
".",
"AppendUint",
"(",
"dst",
",",
"uint64",
"(",
"val",
")",
",",
"10",
")",
"\n",
"}"
] | // AppendUint converts the input uint to a string and
// appends the encoded string to the input byte slice. | [
"AppendUint",
"converts",
"the",
"input",
"uint",
"to",
"a",
"string",
"and",
"appends",
"the",
"encoded",
"string",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L189-L191 |
147,306 | rs/zerolog | internal/json/types.go | AppendUints | func (Encoder) AppendUints(dst []byte, vals []uint) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendUint(dst, uint64(vals[0]), 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendUint(append(dst, ','), uint64(val), 10)
}
}
dst = append(dst, ']')
return dst
} | go | func (Encoder) AppendUints(dst []byte, vals []uint) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendUint(dst, uint64(vals[0]), 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendUint(append(dst, ','), uint64(val), 10)
}
}
dst = append(dst, ']')
return dst
} | [
"func",
"(",
"Encoder",
")",
"AppendUints",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"uint",
")",
"[",
"]",
"byte",
"{",
"if",
"len",
"(",
"vals",
")",
"==",
"0",
"{",
"return",
"append",
"(",
"dst",
",",
"'['",
",",
"']'",
")",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"'['",
")",
"\n",
"dst",
"=",
"strconv",
".",
"AppendUint",
"(",
"dst",
",",
"uint64",
"(",
"vals",
"[",
"0",
"]",
")",
",",
"10",
")",
"\n",
"if",
"len",
"(",
"vals",
")",
">",
"1",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"vals",
"[",
"1",
":",
"]",
"{",
"dst",
"=",
"strconv",
".",
"AppendUint",
"(",
"append",
"(",
"dst",
",",
"','",
")",
",",
"uint64",
"(",
"val",
")",
",",
"10",
")",
"\n",
"}",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"']'",
")",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendUints encodes the input uints to json and
// appends the encoded string list to the input byte slice. | [
"AppendUints",
"encodes",
"the",
"input",
"uints",
"to",
"json",
"and",
"appends",
"the",
"encoded",
"string",
"list",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L195-L208 |
147,307 | rs/zerolog | internal/json/types.go | AppendUint8 | func (Encoder) AppendUint8(dst []byte, val uint8) []byte {
return strconv.AppendUint(dst, uint64(val), 10)
} | go | func (Encoder) AppendUint8(dst []byte, val uint8) []byte {
return strconv.AppendUint(dst, uint64(val), 10)
} | [
"func",
"(",
"Encoder",
")",
"AppendUint8",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"uint8",
")",
"[",
"]",
"byte",
"{",
"return",
"strconv",
".",
"AppendUint",
"(",
"dst",
",",
"uint64",
"(",
"val",
")",
",",
"10",
")",
"\n",
"}"
] | // AppendUint8 converts the input uint8 to a string and
// appends the encoded string to the input byte slice. | [
"AppendUint8",
"converts",
"the",
"input",
"uint8",
"to",
"a",
"string",
"and",
"appends",
"the",
"encoded",
"string",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L212-L214 |
147,308 | rs/zerolog | internal/json/types.go | AppendUints8 | func (Encoder) AppendUints8(dst []byte, vals []uint8) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendUint(dst, uint64(vals[0]), 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendUint(append(dst, ','), uint64(val), 10)
}
}
dst = append(dst, ']')
return dst
} | go | func (Encoder) AppendUints8(dst []byte, vals []uint8) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendUint(dst, uint64(vals[0]), 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendUint(append(dst, ','), uint64(val), 10)
}
}
dst = append(dst, ']')
return dst
} | [
"func",
"(",
"Encoder",
")",
"AppendUints8",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"uint8",
")",
"[",
"]",
"byte",
"{",
"if",
"len",
"(",
"vals",
")",
"==",
"0",
"{",
"return",
"append",
"(",
"dst",
",",
"'['",
",",
"']'",
")",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"'['",
")",
"\n",
"dst",
"=",
"strconv",
".",
"AppendUint",
"(",
"dst",
",",
"uint64",
"(",
"vals",
"[",
"0",
"]",
")",
",",
"10",
")",
"\n",
"if",
"len",
"(",
"vals",
")",
">",
"1",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"vals",
"[",
"1",
":",
"]",
"{",
"dst",
"=",
"strconv",
".",
"AppendUint",
"(",
"append",
"(",
"dst",
",",
"','",
")",
",",
"uint64",
"(",
"val",
")",
",",
"10",
")",
"\n",
"}",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"']'",
")",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendUints8 encodes the input uint8s to json and
// appends the encoded string list to the input byte slice. | [
"AppendUints8",
"encodes",
"the",
"input",
"uint8s",
"to",
"json",
"and",
"appends",
"the",
"encoded",
"string",
"list",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L218-L231 |
147,309 | rs/zerolog | internal/json/types.go | AppendUint16 | func (Encoder) AppendUint16(dst []byte, val uint16) []byte {
return strconv.AppendUint(dst, uint64(val), 10)
} | go | func (Encoder) AppendUint16(dst []byte, val uint16) []byte {
return strconv.AppendUint(dst, uint64(val), 10)
} | [
"func",
"(",
"Encoder",
")",
"AppendUint16",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"uint16",
")",
"[",
"]",
"byte",
"{",
"return",
"strconv",
".",
"AppendUint",
"(",
"dst",
",",
"uint64",
"(",
"val",
")",
",",
"10",
")",
"\n",
"}"
] | // AppendUint16 converts the input uint16 to a string and
// appends the encoded string to the input byte slice. | [
"AppendUint16",
"converts",
"the",
"input",
"uint16",
"to",
"a",
"string",
"and",
"appends",
"the",
"encoded",
"string",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L235-L237 |
147,310 | rs/zerolog | internal/json/types.go | AppendUints16 | func (Encoder) AppendUints16(dst []byte, vals []uint16) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendUint(dst, uint64(vals[0]), 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendUint(append(dst, ','), uint64(val), 10)
}
}
dst = append(dst, ']')
return dst
} | go | func (Encoder) AppendUints16(dst []byte, vals []uint16) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendUint(dst, uint64(vals[0]), 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendUint(append(dst, ','), uint64(val), 10)
}
}
dst = append(dst, ']')
return dst
} | [
"func",
"(",
"Encoder",
")",
"AppendUints16",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"uint16",
")",
"[",
"]",
"byte",
"{",
"if",
"len",
"(",
"vals",
")",
"==",
"0",
"{",
"return",
"append",
"(",
"dst",
",",
"'['",
",",
"']'",
")",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"'['",
")",
"\n",
"dst",
"=",
"strconv",
".",
"AppendUint",
"(",
"dst",
",",
"uint64",
"(",
"vals",
"[",
"0",
"]",
")",
",",
"10",
")",
"\n",
"if",
"len",
"(",
"vals",
")",
">",
"1",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"vals",
"[",
"1",
":",
"]",
"{",
"dst",
"=",
"strconv",
".",
"AppendUint",
"(",
"append",
"(",
"dst",
",",
"','",
")",
",",
"uint64",
"(",
"val",
")",
",",
"10",
")",
"\n",
"}",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"']'",
")",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendUints16 encodes the input uint16s to json and
// appends the encoded string list to the input byte slice. | [
"AppendUints16",
"encodes",
"the",
"input",
"uint16s",
"to",
"json",
"and",
"appends",
"the",
"encoded",
"string",
"list",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L241-L254 |
147,311 | rs/zerolog | internal/json/types.go | AppendUint32 | func (Encoder) AppendUint32(dst []byte, val uint32) []byte {
return strconv.AppendUint(dst, uint64(val), 10)
} | go | func (Encoder) AppendUint32(dst []byte, val uint32) []byte {
return strconv.AppendUint(dst, uint64(val), 10)
} | [
"func",
"(",
"Encoder",
")",
"AppendUint32",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"uint32",
")",
"[",
"]",
"byte",
"{",
"return",
"strconv",
".",
"AppendUint",
"(",
"dst",
",",
"uint64",
"(",
"val",
")",
",",
"10",
")",
"\n",
"}"
] | // AppendUint32 converts the input uint32 to a string and
// appends the encoded string to the input byte slice. | [
"AppendUint32",
"converts",
"the",
"input",
"uint32",
"to",
"a",
"string",
"and",
"appends",
"the",
"encoded",
"string",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L258-L260 |
147,312 | rs/zerolog | internal/json/types.go | AppendUints32 | func (Encoder) AppendUints32(dst []byte, vals []uint32) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendUint(dst, uint64(vals[0]), 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendUint(append(dst, ','), uint64(val), 10)
}
}
dst = append(dst, ']')
return dst
} | go | func (Encoder) AppendUints32(dst []byte, vals []uint32) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendUint(dst, uint64(vals[0]), 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendUint(append(dst, ','), uint64(val), 10)
}
}
dst = append(dst, ']')
return dst
} | [
"func",
"(",
"Encoder",
")",
"AppendUints32",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"uint32",
")",
"[",
"]",
"byte",
"{",
"if",
"len",
"(",
"vals",
")",
"==",
"0",
"{",
"return",
"append",
"(",
"dst",
",",
"'['",
",",
"']'",
")",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"'['",
")",
"\n",
"dst",
"=",
"strconv",
".",
"AppendUint",
"(",
"dst",
",",
"uint64",
"(",
"vals",
"[",
"0",
"]",
")",
",",
"10",
")",
"\n",
"if",
"len",
"(",
"vals",
")",
">",
"1",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"vals",
"[",
"1",
":",
"]",
"{",
"dst",
"=",
"strconv",
".",
"AppendUint",
"(",
"append",
"(",
"dst",
",",
"','",
")",
",",
"uint64",
"(",
"val",
")",
",",
"10",
")",
"\n",
"}",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"']'",
")",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendUints32 encodes the input uint32s to json and
// appends the encoded string list to the input byte slice. | [
"AppendUints32",
"encodes",
"the",
"input",
"uint32s",
"to",
"json",
"and",
"appends",
"the",
"encoded",
"string",
"list",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L264-L277 |
147,313 | rs/zerolog | internal/json/types.go | AppendUint64 | func (Encoder) AppendUint64(dst []byte, val uint64) []byte {
return strconv.AppendUint(dst, uint64(val), 10)
} | go | func (Encoder) AppendUint64(dst []byte, val uint64) []byte {
return strconv.AppendUint(dst, uint64(val), 10)
} | [
"func",
"(",
"Encoder",
")",
"AppendUint64",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"uint64",
")",
"[",
"]",
"byte",
"{",
"return",
"strconv",
".",
"AppendUint",
"(",
"dst",
",",
"uint64",
"(",
"val",
")",
",",
"10",
")",
"\n",
"}"
] | // AppendUint64 converts the input uint64 to a string and
// appends the encoded string to the input byte slice. | [
"AppendUint64",
"converts",
"the",
"input",
"uint64",
"to",
"a",
"string",
"and",
"appends",
"the",
"encoded",
"string",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L281-L283 |
147,314 | rs/zerolog | internal/json/types.go | AppendUints64 | func (Encoder) AppendUints64(dst []byte, vals []uint64) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendUint(dst, vals[0], 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendUint(append(dst, ','), val, 10)
}
}
dst = append(dst, ']')
return dst
} | go | func (Encoder) AppendUints64(dst []byte, vals []uint64) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = strconv.AppendUint(dst, vals[0], 10)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = strconv.AppendUint(append(dst, ','), val, 10)
}
}
dst = append(dst, ']')
return dst
} | [
"func",
"(",
"Encoder",
")",
"AppendUints64",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"uint64",
")",
"[",
"]",
"byte",
"{",
"if",
"len",
"(",
"vals",
")",
"==",
"0",
"{",
"return",
"append",
"(",
"dst",
",",
"'['",
",",
"']'",
")",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"'['",
")",
"\n",
"dst",
"=",
"strconv",
".",
"AppendUint",
"(",
"dst",
",",
"vals",
"[",
"0",
"]",
",",
"10",
")",
"\n",
"if",
"len",
"(",
"vals",
")",
">",
"1",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"vals",
"[",
"1",
":",
"]",
"{",
"dst",
"=",
"strconv",
".",
"AppendUint",
"(",
"append",
"(",
"dst",
",",
"','",
")",
",",
"val",
",",
"10",
")",
"\n",
"}",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"']'",
")",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendUints64 encodes the input uint64s to json and
// appends the encoded string list to the input byte slice. | [
"AppendUints64",
"encodes",
"the",
"input",
"uint64s",
"to",
"json",
"and",
"appends",
"the",
"encoded",
"string",
"list",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L287-L300 |
147,315 | rs/zerolog | internal/json/types.go | AppendFloat32 | func (Encoder) AppendFloat32(dst []byte, val float32) []byte {
return appendFloat(dst, float64(val), 32)
} | go | func (Encoder) AppendFloat32(dst []byte, val float32) []byte {
return appendFloat(dst, float64(val), 32)
} | [
"func",
"(",
"Encoder",
")",
"AppendFloat32",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"float32",
")",
"[",
"]",
"byte",
"{",
"return",
"appendFloat",
"(",
"dst",
",",
"float64",
"(",
"val",
")",
",",
"32",
")",
"\n",
"}"
] | // AppendFloat32 converts the input float32 to a string and
// appends the encoded string to the input byte slice. | [
"AppendFloat32",
"converts",
"the",
"input",
"float32",
"to",
"a",
"string",
"and",
"appends",
"the",
"encoded",
"string",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L319-L321 |
147,316 | rs/zerolog | internal/json/types.go | AppendFloats32 | func (Encoder) AppendFloats32(dst []byte, vals []float32) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = appendFloat(dst, float64(vals[0]), 32)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = appendFloat(append(dst, ','), float64(val), 32)
}
}
dst = append(dst, ']')
return dst
} | go | func (Encoder) AppendFloats32(dst []byte, vals []float32) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = appendFloat(dst, float64(vals[0]), 32)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = appendFloat(append(dst, ','), float64(val), 32)
}
}
dst = append(dst, ']')
return dst
} | [
"func",
"(",
"Encoder",
")",
"AppendFloats32",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"float32",
")",
"[",
"]",
"byte",
"{",
"if",
"len",
"(",
"vals",
")",
"==",
"0",
"{",
"return",
"append",
"(",
"dst",
",",
"'['",
",",
"']'",
")",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"'['",
")",
"\n",
"dst",
"=",
"appendFloat",
"(",
"dst",
",",
"float64",
"(",
"vals",
"[",
"0",
"]",
")",
",",
"32",
")",
"\n",
"if",
"len",
"(",
"vals",
")",
">",
"1",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"vals",
"[",
"1",
":",
"]",
"{",
"dst",
"=",
"appendFloat",
"(",
"append",
"(",
"dst",
",",
"','",
")",
",",
"float64",
"(",
"val",
")",
",",
"32",
")",
"\n",
"}",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"']'",
")",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendFloats32 encodes the input float32s to json and
// appends the encoded string list to the input byte slice. | [
"AppendFloats32",
"encodes",
"the",
"input",
"float32s",
"to",
"json",
"and",
"appends",
"the",
"encoded",
"string",
"list",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L325-L338 |
147,317 | rs/zerolog | internal/json/types.go | AppendFloat64 | func (Encoder) AppendFloat64(dst []byte, val float64) []byte {
return appendFloat(dst, val, 64)
} | go | func (Encoder) AppendFloat64(dst []byte, val float64) []byte {
return appendFloat(dst, val, 64)
} | [
"func",
"(",
"Encoder",
")",
"AppendFloat64",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"float64",
")",
"[",
"]",
"byte",
"{",
"return",
"appendFloat",
"(",
"dst",
",",
"val",
",",
"64",
")",
"\n",
"}"
] | // AppendFloat64 converts the input float64 to a string and
// appends the encoded string to the input byte slice. | [
"AppendFloat64",
"converts",
"the",
"input",
"float64",
"to",
"a",
"string",
"and",
"appends",
"the",
"encoded",
"string",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L342-L344 |
147,318 | rs/zerolog | internal/json/types.go | AppendFloats64 | func (Encoder) AppendFloats64(dst []byte, vals []float64) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = appendFloat(dst, vals[0], 32)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = appendFloat(append(dst, ','), val, 64)
}
}
dst = append(dst, ']')
return dst
} | go | func (Encoder) AppendFloats64(dst []byte, vals []float64) []byte {
if len(vals) == 0 {
return append(dst, '[', ']')
}
dst = append(dst, '[')
dst = appendFloat(dst, vals[0], 32)
if len(vals) > 1 {
for _, val := range vals[1:] {
dst = appendFloat(append(dst, ','), val, 64)
}
}
dst = append(dst, ']')
return dst
} | [
"func",
"(",
"Encoder",
")",
"AppendFloats64",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"float64",
")",
"[",
"]",
"byte",
"{",
"if",
"len",
"(",
"vals",
")",
"==",
"0",
"{",
"return",
"append",
"(",
"dst",
",",
"'['",
",",
"']'",
")",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"'['",
")",
"\n",
"dst",
"=",
"appendFloat",
"(",
"dst",
",",
"vals",
"[",
"0",
"]",
",",
"32",
")",
"\n",
"if",
"len",
"(",
"vals",
")",
">",
"1",
"{",
"for",
"_",
",",
"val",
":=",
"range",
"vals",
"[",
"1",
":",
"]",
"{",
"dst",
"=",
"appendFloat",
"(",
"append",
"(",
"dst",
",",
"','",
")",
",",
"val",
",",
"64",
")",
"\n",
"}",
"\n",
"}",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"']'",
")",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendFloats64 encodes the input float64s to json and
// appends the encoded string list to the input byte slice. | [
"AppendFloats64",
"encodes",
"the",
"input",
"float64s",
"to",
"json",
"and",
"appends",
"the",
"encoded",
"string",
"list",
"to",
"the",
"input",
"byte",
"slice",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L348-L361 |
147,319 | rs/zerolog | internal/json/types.go | AppendObjectData | func (Encoder) AppendObjectData(dst []byte, o []byte) []byte {
// Two conditions we want to put a ',' between existing content and
// new content:
// 1. new content starts with '{' - which shd be dropped OR
// 2. existing content has already other fields
if o[0] == '{' {
o[0] = ','
} else if len(dst) > 1 {
dst = append(dst, ',')
}
return append(dst, o...)
} | go | func (Encoder) AppendObjectData(dst []byte, o []byte) []byte {
// Two conditions we want to put a ',' between existing content and
// new content:
// 1. new content starts with '{' - which shd be dropped OR
// 2. existing content has already other fields
if o[0] == '{' {
o[0] = ','
} else if len(dst) > 1 {
dst = append(dst, ',')
}
return append(dst, o...)
} | [
"func",
"(",
"Encoder",
")",
"AppendObjectData",
"(",
"dst",
"[",
"]",
"byte",
",",
"o",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"// Two conditions we want to put a ',' between existing content and",
"// new content:",
"// 1. new content starts with '{' - which shd be dropped OR",
"// 2. existing content has already other fields",
"if",
"o",
"[",
"0",
"]",
"==",
"'{'",
"{",
"o",
"[",
"0",
"]",
"=",
"','",
"\n",
"}",
"else",
"if",
"len",
"(",
"dst",
")",
">",
"1",
"{",
"dst",
"=",
"append",
"(",
"dst",
",",
"','",
")",
"\n",
"}",
"\n",
"return",
"append",
"(",
"dst",
",",
"o",
"...",
")",
"\n",
"}"
] | // AppendObjectData takes in an object that is already in a byte array
// and adds it to the dst. | [
"AppendObjectData",
"takes",
"in",
"an",
"object",
"that",
"is",
"already",
"in",
"a",
"byte",
"array",
"and",
"adds",
"it",
"to",
"the",
"dst",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L375-L386 |
147,320 | rs/zerolog | internal/json/types.go | AppendIPAddr | func (e Encoder) AppendIPAddr(dst []byte, ip net.IP) []byte {
return e.AppendString(dst, ip.String())
} | go | func (e Encoder) AppendIPAddr(dst []byte, ip net.IP) []byte {
return e.AppendString(dst, ip.String())
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendIPAddr",
"(",
"dst",
"[",
"]",
"byte",
",",
"ip",
"net",
".",
"IP",
")",
"[",
"]",
"byte",
"{",
"return",
"e",
".",
"AppendString",
"(",
"dst",
",",
"ip",
".",
"String",
"(",
")",
")",
"\n",
"}"
] | // AppendIPAddr adds IPv4 or IPv6 address to dst. | [
"AppendIPAddr",
"adds",
"IPv4",
"or",
"IPv6",
"address",
"to",
"dst",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L389-L391 |
147,321 | rs/zerolog | internal/json/types.go | AppendMACAddr | func (e Encoder) AppendMACAddr(dst []byte, ha net.HardwareAddr) []byte {
return e.AppendString(dst, ha.String())
} | go | func (e Encoder) AppendMACAddr(dst []byte, ha net.HardwareAddr) []byte {
return e.AppendString(dst, ha.String())
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendMACAddr",
"(",
"dst",
"[",
"]",
"byte",
",",
"ha",
"net",
".",
"HardwareAddr",
")",
"[",
"]",
"byte",
"{",
"return",
"e",
".",
"AppendString",
"(",
"dst",
",",
"ha",
".",
"String",
"(",
")",
")",
"\n",
"}"
] | // AppendMACAddr adds MAC address to dst. | [
"AppendMACAddr",
"adds",
"MAC",
"address",
"to",
"dst",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/json/types.go#L400-L402 |
147,322 | rs/zerolog | journald/journald.go | levelToJPrio | func levelToJPrio(zLevel string) journal.Priority {
lvl, _ := zerolog.ParseLevel(zLevel)
switch lvl {
case zerolog.DebugLevel:
return journal.PriDebug
case zerolog.InfoLevel:
return journal.PriInfo
case zerolog.WarnLevel:
return journal.PriWarning
case zerolog.ErrorLevel:
return journal.PriErr
case zerolog.FatalLevel:
return journal.PriCrit
case zerolog.PanicLevel:
return journal.PriEmerg
case zerolog.NoLevel:
return journal.PriNotice
}
return defaultJournalDPrio
} | go | func levelToJPrio(zLevel string) journal.Priority {
lvl, _ := zerolog.ParseLevel(zLevel)
switch lvl {
case zerolog.DebugLevel:
return journal.PriDebug
case zerolog.InfoLevel:
return journal.PriInfo
case zerolog.WarnLevel:
return journal.PriWarning
case zerolog.ErrorLevel:
return journal.PriErr
case zerolog.FatalLevel:
return journal.PriCrit
case zerolog.PanicLevel:
return journal.PriEmerg
case zerolog.NoLevel:
return journal.PriNotice
}
return defaultJournalDPrio
} | [
"func",
"levelToJPrio",
"(",
"zLevel",
"string",
")",
"journal",
".",
"Priority",
"{",
"lvl",
",",
"_",
":=",
"zerolog",
".",
"ParseLevel",
"(",
"zLevel",
")",
"\n\n",
"switch",
"lvl",
"{",
"case",
"zerolog",
".",
"DebugLevel",
":",
"return",
"journal",
".",
"PriDebug",
"\n",
"case",
"zerolog",
".",
"InfoLevel",
":",
"return",
"journal",
".",
"PriInfo",
"\n",
"case",
"zerolog",
".",
"WarnLevel",
":",
"return",
"journal",
".",
"PriWarning",
"\n",
"case",
"zerolog",
".",
"ErrorLevel",
":",
"return",
"journal",
".",
"PriErr",
"\n",
"case",
"zerolog",
".",
"FatalLevel",
":",
"return",
"journal",
".",
"PriCrit",
"\n",
"case",
"zerolog",
".",
"PanicLevel",
":",
"return",
"journal",
".",
"PriEmerg",
"\n",
"case",
"zerolog",
".",
"NoLevel",
":",
"return",
"journal",
".",
"PriNotice",
"\n",
"}",
"\n",
"return",
"defaultJournalDPrio",
"\n",
"}"
] | // levelToJPrio converts zerolog Level string into
// journalD's priority values. JournalD has more
// priorities than zerolog. | [
"levelToJPrio",
"converts",
"zerolog",
"Level",
"string",
"into",
"journalD",
"s",
"priority",
"values",
".",
"JournalD",
"has",
"more",
"priorities",
"than",
"zerolog",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/journald/journald.go#L46-L66 |
147,323 | rs/zerolog | diode/internal/diodes/waiter.go | NewWaiter | func NewWaiter(d Diode, opts ...WaiterConfigOption) *Waiter {
w := new(Waiter)
w.Diode = d
w.c = sync.NewCond(&w.mu)
w.ctx = context.Background()
for _, opt := range opts {
opt(w)
}
go func() {
<-w.ctx.Done()
w.c.Broadcast()
}()
return w
} | go | func NewWaiter(d Diode, opts ...WaiterConfigOption) *Waiter {
w := new(Waiter)
w.Diode = d
w.c = sync.NewCond(&w.mu)
w.ctx = context.Background()
for _, opt := range opts {
opt(w)
}
go func() {
<-w.ctx.Done()
w.c.Broadcast()
}()
return w
} | [
"func",
"NewWaiter",
"(",
"d",
"Diode",
",",
"opts",
"...",
"WaiterConfigOption",
")",
"*",
"Waiter",
"{",
"w",
":=",
"new",
"(",
"Waiter",
")",
"\n",
"w",
".",
"Diode",
"=",
"d",
"\n",
"w",
".",
"c",
"=",
"sync",
".",
"NewCond",
"(",
"&",
"w",
".",
"mu",
")",
"\n",
"w",
".",
"ctx",
"=",
"context",
".",
"Background",
"(",
")",
"\n\n",
"for",
"_",
",",
"opt",
":=",
"range",
"opts",
"{",
"opt",
"(",
"w",
")",
"\n",
"}",
"\n\n",
"go",
"func",
"(",
")",
"{",
"<-",
"w",
".",
"ctx",
".",
"Done",
"(",
")",
"\n",
"w",
".",
"c",
".",
"Broadcast",
"(",
")",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"w",
"\n",
"}"
] | // NewWaiter returns a new Waiter that wraps the given diode. | [
"NewWaiter",
"returns",
"a",
"new",
"Waiter",
"that",
"wraps",
"the",
"given",
"diode",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/diode/internal/diodes/waiter.go#L30-L46 |
147,324 | rs/zerolog | diode/internal/diodes/waiter.go | Set | func (w *Waiter) Set(data GenericDataType) {
w.Diode.Set(data)
w.c.Broadcast()
} | go | func (w *Waiter) Set(data GenericDataType) {
w.Diode.Set(data)
w.c.Broadcast()
} | [
"func",
"(",
"w",
"*",
"Waiter",
")",
"Set",
"(",
"data",
"GenericDataType",
")",
"{",
"w",
".",
"Diode",
".",
"Set",
"(",
"data",
")",
"\n",
"w",
".",
"c",
".",
"Broadcast",
"(",
")",
"\n",
"}"
] | // Set invokes the wrapped diode's Set with the given data and uses Broadcast
// to wake up any readers. | [
"Set",
"invokes",
"the",
"wrapped",
"diode",
"s",
"Set",
"with",
"the",
"given",
"data",
"and",
"uses",
"Broadcast",
"to",
"wake",
"up",
"any",
"readers",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/diode/internal/diodes/waiter.go#L50-L53 |
147,325 | rs/zerolog | diode/internal/diodes/waiter.go | Next | func (w *Waiter) Next() GenericDataType {
w.mu.Lock()
defer w.mu.Unlock()
for {
data, ok := w.Diode.TryNext()
if !ok {
if w.isDone() {
return nil
}
w.c.Wait()
continue
}
return data
}
} | go | func (w *Waiter) Next() GenericDataType {
w.mu.Lock()
defer w.mu.Unlock()
for {
data, ok := w.Diode.TryNext()
if !ok {
if w.isDone() {
return nil
}
w.c.Wait()
continue
}
return data
}
} | [
"func",
"(",
"w",
"*",
"Waiter",
")",
"Next",
"(",
")",
"GenericDataType",
"{",
"w",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"w",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"{",
"data",
",",
"ok",
":=",
"w",
".",
"Diode",
".",
"TryNext",
"(",
")",
"\n",
"if",
"!",
"ok",
"{",
"if",
"w",
".",
"isDone",
"(",
")",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"w",
".",
"c",
".",
"Wait",
"(",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"return",
"data",
"\n",
"}",
"\n",
"}"
] | // Next returns the next data point on the wrapped diode. If there is not any
// new data, it will Wait for set to be called or the context to be done.
// If the context is done, then nil will be returned. | [
"Next",
"returns",
"the",
"next",
"data",
"point",
"on",
"the",
"wrapped",
"diode",
".",
"If",
"there",
"is",
"not",
"any",
"new",
"data",
"it",
"will",
"Wait",
"for",
"set",
"to",
"be",
"called",
"or",
"the",
"context",
"to",
"be",
"done",
".",
"If",
"the",
"context",
"is",
"done",
"then",
"nil",
"will",
"be",
"returned",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/diode/internal/diodes/waiter.go#L58-L74 |
147,326 | rs/zerolog | internal/cbor/types.go | AppendNil | func (Encoder) AppendNil(dst []byte) []byte {
return append(dst, byte(majorTypeSimpleAndFloat|additionalTypeNull))
} | go | func (Encoder) AppendNil(dst []byte) []byte {
return append(dst, byte(majorTypeSimpleAndFloat|additionalTypeNull))
} | [
"func",
"(",
"Encoder",
")",
"AppendNil",
"(",
"dst",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"return",
"append",
"(",
"dst",
",",
"byte",
"(",
"majorTypeSimpleAndFloat",
"|",
"additionalTypeNull",
")",
")",
"\n",
"}"
] | // AppendNil inserts a 'Nil' object into the dst byte array. | [
"AppendNil",
"inserts",
"a",
"Nil",
"object",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L11-L13 |
147,327 | rs/zerolog | internal/cbor/types.go | AppendBeginMarker | func (Encoder) AppendBeginMarker(dst []byte) []byte {
return append(dst, byte(majorTypeMap|additionalTypeInfiniteCount))
} | go | func (Encoder) AppendBeginMarker(dst []byte) []byte {
return append(dst, byte(majorTypeMap|additionalTypeInfiniteCount))
} | [
"func",
"(",
"Encoder",
")",
"AppendBeginMarker",
"(",
"dst",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"return",
"append",
"(",
"dst",
",",
"byte",
"(",
"majorTypeMap",
"|",
"additionalTypeInfiniteCount",
")",
")",
"\n",
"}"
] | // AppendBeginMarker inserts a map start into the dst byte array. | [
"AppendBeginMarker",
"inserts",
"a",
"map",
"start",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L16-L18 |
147,328 | rs/zerolog | internal/cbor/types.go | AppendEndMarker | func (Encoder) AppendEndMarker(dst []byte) []byte {
return append(dst, byte(majorTypeSimpleAndFloat|additionalTypeBreak))
} | go | func (Encoder) AppendEndMarker(dst []byte) []byte {
return append(dst, byte(majorTypeSimpleAndFloat|additionalTypeBreak))
} | [
"func",
"(",
"Encoder",
")",
"AppendEndMarker",
"(",
"dst",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"return",
"append",
"(",
"dst",
",",
"byte",
"(",
"majorTypeSimpleAndFloat",
"|",
"additionalTypeBreak",
")",
")",
"\n",
"}"
] | // AppendEndMarker inserts a map end into the dst byte array. | [
"AppendEndMarker",
"inserts",
"a",
"map",
"end",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L21-L23 |
147,329 | rs/zerolog | internal/cbor/types.go | AppendObjectData | func (Encoder) AppendObjectData(dst []byte, o []byte) []byte {
// BeginMarker is present in the dst, which
// should not be copied when appending to existing data.
return append(dst, o[1:]...)
} | go | func (Encoder) AppendObjectData(dst []byte, o []byte) []byte {
// BeginMarker is present in the dst, which
// should not be copied when appending to existing data.
return append(dst, o[1:]...)
} | [
"func",
"(",
"Encoder",
")",
"AppendObjectData",
"(",
"dst",
"[",
"]",
"byte",
",",
"o",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"// BeginMarker is present in the dst, which",
"// should not be copied when appending to existing data.",
"return",
"append",
"(",
"dst",
",",
"o",
"[",
"1",
":",
"]",
"...",
")",
"\n",
"}"
] | // AppendObjectData takes an object in form of a byte array and appends to dst. | [
"AppendObjectData",
"takes",
"an",
"object",
"in",
"form",
"of",
"a",
"byte",
"array",
"and",
"appends",
"to",
"dst",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L26-L30 |
147,330 | rs/zerolog | internal/cbor/types.go | AppendArrayStart | func (Encoder) AppendArrayStart(dst []byte) []byte {
return append(dst, byte(majorTypeArray|additionalTypeInfiniteCount))
} | go | func (Encoder) AppendArrayStart(dst []byte) []byte {
return append(dst, byte(majorTypeArray|additionalTypeInfiniteCount))
} | [
"func",
"(",
"Encoder",
")",
"AppendArrayStart",
"(",
"dst",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"return",
"append",
"(",
"dst",
",",
"byte",
"(",
"majorTypeArray",
"|",
"additionalTypeInfiniteCount",
")",
")",
"\n",
"}"
] | // AppendArrayStart adds markers to indicate the start of an array. | [
"AppendArrayStart",
"adds",
"markers",
"to",
"indicate",
"the",
"start",
"of",
"an",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L33-L35 |
147,331 | rs/zerolog | internal/cbor/types.go | AppendArrayEnd | func (Encoder) AppendArrayEnd(dst []byte) []byte {
return append(dst, byte(majorTypeSimpleAndFloat|additionalTypeBreak))
} | go | func (Encoder) AppendArrayEnd(dst []byte) []byte {
return append(dst, byte(majorTypeSimpleAndFloat|additionalTypeBreak))
} | [
"func",
"(",
"Encoder",
")",
"AppendArrayEnd",
"(",
"dst",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"return",
"append",
"(",
"dst",
",",
"byte",
"(",
"majorTypeSimpleAndFloat",
"|",
"additionalTypeBreak",
")",
")",
"\n",
"}"
] | // AppendArrayEnd adds markers to indicate the end of an array. | [
"AppendArrayEnd",
"adds",
"markers",
"to",
"indicate",
"the",
"end",
"of",
"an",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L38-L40 |
147,332 | rs/zerolog | internal/cbor/types.go | AppendBool | func (Encoder) AppendBool(dst []byte, val bool) []byte {
b := additionalTypeBoolFalse
if val {
b = additionalTypeBoolTrue
}
return append(dst, byte(majorTypeSimpleAndFloat|b))
} | go | func (Encoder) AppendBool(dst []byte, val bool) []byte {
b := additionalTypeBoolFalse
if val {
b = additionalTypeBoolTrue
}
return append(dst, byte(majorTypeSimpleAndFloat|b))
} | [
"func",
"(",
"Encoder",
")",
"AppendBool",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"bool",
")",
"[",
"]",
"byte",
"{",
"b",
":=",
"additionalTypeBoolFalse",
"\n",
"if",
"val",
"{",
"b",
"=",
"additionalTypeBoolTrue",
"\n",
"}",
"\n",
"return",
"append",
"(",
"dst",
",",
"byte",
"(",
"majorTypeSimpleAndFloat",
"|",
"b",
")",
")",
"\n",
"}"
] | // AppendBool encodes and inserts a boolean value into the dst byte array. | [
"AppendBool",
"encodes",
"and",
"inserts",
"a",
"boolean",
"value",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L55-L61 |
147,333 | rs/zerolog | internal/cbor/types.go | AppendBools | func (e Encoder) AppendBools(dst []byte, vals []bool) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendBool(dst, v)
}
return dst
} | go | func (e Encoder) AppendBools(dst []byte, vals []bool) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendBool(dst, v)
}
return dst
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendBools",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"bool",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeArray",
"\n",
"l",
":=",
"len",
"(",
"vals",
")",
"\n",
"if",
"l",
"==",
"0",
"{",
"return",
"e",
".",
"AppendArrayEnd",
"(",
"e",
".",
"AppendArrayStart",
"(",
"dst",
")",
")",
"\n",
"}",
"\n",
"if",
"l",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"l",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"l",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"vals",
"{",
"dst",
"=",
"e",
".",
"AppendBool",
"(",
"dst",
",",
"v",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendBools encodes and inserts an array of boolean values into the dst byte array. | [
"AppendBools",
"encodes",
"and",
"inserts",
"an",
"array",
"of",
"boolean",
"values",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L64-L80 |
147,334 | rs/zerolog | internal/cbor/types.go | AppendInt | func (Encoder) AppendInt(dst []byte, val int) []byte {
major := majorTypeUnsignedInt
contentVal := val
if val < 0 {
major = majorTypeNegativeInt
contentVal = -val - 1
}
if contentVal <= additionalMax {
lb := byte(contentVal)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(contentVal))
}
return dst
} | go | func (Encoder) AppendInt(dst []byte, val int) []byte {
major := majorTypeUnsignedInt
contentVal := val
if val < 0 {
major = majorTypeNegativeInt
contentVal = -val - 1
}
if contentVal <= additionalMax {
lb := byte(contentVal)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(contentVal))
}
return dst
} | [
"func",
"(",
"Encoder",
")",
"AppendInt",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"int",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeUnsignedInt",
"\n",
"contentVal",
":=",
"val",
"\n",
"if",
"val",
"<",
"0",
"{",
"major",
"=",
"majorTypeNegativeInt",
"\n",
"contentVal",
"=",
"-",
"val",
"-",
"1",
"\n",
"}",
"\n",
"if",
"contentVal",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"contentVal",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"contentVal",
")",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendInt encodes and inserts an integer value into the dst byte array. | [
"AppendInt",
"encodes",
"and",
"inserts",
"an",
"integer",
"value",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L83-L97 |
147,335 | rs/zerolog | internal/cbor/types.go | AppendInt8 | func (e Encoder) AppendInt8(dst []byte, val int8) []byte {
return e.AppendInt(dst, int(val))
} | go | func (e Encoder) AppendInt8(dst []byte, val int8) []byte {
return e.AppendInt(dst, int(val))
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendInt8",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"int8",
")",
"[",
"]",
"byte",
"{",
"return",
"e",
".",
"AppendInt",
"(",
"dst",
",",
"int",
"(",
"val",
")",
")",
"\n",
"}"
] | // AppendInt8 encodes and inserts an int8 value into the dst byte array. | [
"AppendInt8",
"encodes",
"and",
"inserts",
"an",
"int8",
"value",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L119-L121 |
147,336 | rs/zerolog | internal/cbor/types.go | AppendInt16 | func (e Encoder) AppendInt16(dst []byte, val int16) []byte {
return e.AppendInt(dst, int(val))
} | go | func (e Encoder) AppendInt16(dst []byte, val int16) []byte {
return e.AppendInt(dst, int(val))
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendInt16",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"int16",
")",
"[",
"]",
"byte",
"{",
"return",
"e",
".",
"AppendInt",
"(",
"dst",
",",
"int",
"(",
"val",
")",
")",
"\n",
"}"
] | // AppendInt16 encodes and inserts a int16 value into the dst byte array. | [
"AppendInt16",
"encodes",
"and",
"inserts",
"a",
"int16",
"value",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L143-L145 |
147,337 | rs/zerolog | internal/cbor/types.go | AppendInts16 | func (e Encoder) AppendInts16(dst []byte, vals []int16) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendInt(dst, int(v))
}
return dst
} | go | func (e Encoder) AppendInts16(dst []byte, vals []int16) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendInt(dst, int(v))
}
return dst
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendInts16",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"int16",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeArray",
"\n",
"l",
":=",
"len",
"(",
"vals",
")",
"\n",
"if",
"l",
"==",
"0",
"{",
"return",
"e",
".",
"AppendArrayEnd",
"(",
"e",
".",
"AppendArrayStart",
"(",
"dst",
")",
")",
"\n",
"}",
"\n",
"if",
"l",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"l",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"l",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"vals",
"{",
"dst",
"=",
"e",
".",
"AppendInt",
"(",
"dst",
",",
"int",
"(",
"v",
")",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendInts16 encodes and inserts an array of int16 values into the dst byte array. | [
"AppendInts16",
"encodes",
"and",
"inserts",
"an",
"array",
"of",
"int16",
"values",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L148-L164 |
147,338 | rs/zerolog | internal/cbor/types.go | AppendInt32 | func (e Encoder) AppendInt32(dst []byte, val int32) []byte {
return e.AppendInt(dst, int(val))
} | go | func (e Encoder) AppendInt32(dst []byte, val int32) []byte {
return e.AppendInt(dst, int(val))
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendInt32",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"int32",
")",
"[",
"]",
"byte",
"{",
"return",
"e",
".",
"AppendInt",
"(",
"dst",
",",
"int",
"(",
"val",
")",
")",
"\n",
"}"
] | // AppendInt32 encodes and inserts a int32 value into the dst byte array. | [
"AppendInt32",
"encodes",
"and",
"inserts",
"a",
"int32",
"value",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L167-L169 |
147,339 | rs/zerolog | internal/cbor/types.go | AppendInt64 | func (Encoder) AppendInt64(dst []byte, val int64) []byte {
major := majorTypeUnsignedInt
contentVal := val
if val < 0 {
major = majorTypeNegativeInt
contentVal = -val - 1
}
if contentVal <= additionalMax {
lb := byte(contentVal)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(contentVal))
}
return dst
} | go | func (Encoder) AppendInt64(dst []byte, val int64) []byte {
major := majorTypeUnsignedInt
contentVal := val
if val < 0 {
major = majorTypeNegativeInt
contentVal = -val - 1
}
if contentVal <= additionalMax {
lb := byte(contentVal)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(contentVal))
}
return dst
} | [
"func",
"(",
"Encoder",
")",
"AppendInt64",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"int64",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeUnsignedInt",
"\n",
"contentVal",
":=",
"val",
"\n",
"if",
"val",
"<",
"0",
"{",
"major",
"=",
"majorTypeNegativeInt",
"\n",
"contentVal",
"=",
"-",
"val",
"-",
"1",
"\n",
"}",
"\n",
"if",
"contentVal",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"contentVal",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"contentVal",
")",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendInt64 encodes and inserts a int64 value into the dst byte array. | [
"AppendInt64",
"encodes",
"and",
"inserts",
"a",
"int64",
"value",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L191-L205 |
147,340 | rs/zerolog | internal/cbor/types.go | AppendInts64 | func (e Encoder) AppendInts64(dst []byte, vals []int64) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendInt64(dst, v)
}
return dst
} | go | func (e Encoder) AppendInts64(dst []byte, vals []int64) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendInt64(dst, v)
}
return dst
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendInts64",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"int64",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeArray",
"\n",
"l",
":=",
"len",
"(",
"vals",
")",
"\n",
"if",
"l",
"==",
"0",
"{",
"return",
"e",
".",
"AppendArrayEnd",
"(",
"e",
".",
"AppendArrayStart",
"(",
"dst",
")",
")",
"\n",
"}",
"\n",
"if",
"l",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"l",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"l",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"vals",
"{",
"dst",
"=",
"e",
".",
"AppendInt64",
"(",
"dst",
",",
"v",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendInts64 encodes and inserts an array of int64 values into the dst byte array. | [
"AppendInts64",
"encodes",
"and",
"inserts",
"an",
"array",
"of",
"int64",
"values",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L208-L224 |
147,341 | rs/zerolog | internal/cbor/types.go | AppendUint | func (e Encoder) AppendUint(dst []byte, val uint) []byte {
return e.AppendInt64(dst, int64(val))
} | go | func (e Encoder) AppendUint(dst []byte, val uint) []byte {
return e.AppendInt64(dst, int64(val))
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendUint",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"uint",
")",
"[",
"]",
"byte",
"{",
"return",
"e",
".",
"AppendInt64",
"(",
"dst",
",",
"int64",
"(",
"val",
")",
")",
"\n",
"}"
] | // AppendUint encodes and inserts an unsigned integer value into the dst byte array. | [
"AppendUint",
"encodes",
"and",
"inserts",
"an",
"unsigned",
"integer",
"value",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L227-L229 |
147,342 | rs/zerolog | internal/cbor/types.go | AppendUints | func (e Encoder) AppendUints(dst []byte, vals []uint) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendUint(dst, v)
}
return dst
} | go | func (e Encoder) AppendUints(dst []byte, vals []uint) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendUint(dst, v)
}
return dst
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendUints",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"uint",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeArray",
"\n",
"l",
":=",
"len",
"(",
"vals",
")",
"\n",
"if",
"l",
"==",
"0",
"{",
"return",
"e",
".",
"AppendArrayEnd",
"(",
"e",
".",
"AppendArrayStart",
"(",
"dst",
")",
")",
"\n",
"}",
"\n",
"if",
"l",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"l",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"l",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"vals",
"{",
"dst",
"=",
"e",
".",
"AppendUint",
"(",
"dst",
",",
"v",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendUints encodes and inserts an array of unsigned integer values into the dst byte array. | [
"AppendUints",
"encodes",
"and",
"inserts",
"an",
"array",
"of",
"unsigned",
"integer",
"values",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L232-L248 |
147,343 | rs/zerolog | internal/cbor/types.go | AppendUint8 | func (e Encoder) AppendUint8(dst []byte, val uint8) []byte {
return e.AppendUint(dst, uint(val))
} | go | func (e Encoder) AppendUint8(dst []byte, val uint8) []byte {
return e.AppendUint(dst, uint(val))
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendUint8",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"uint8",
")",
"[",
"]",
"byte",
"{",
"return",
"e",
".",
"AppendUint",
"(",
"dst",
",",
"uint",
"(",
"val",
")",
")",
"\n",
"}"
] | // AppendUint8 encodes and inserts a unsigned int8 value into the dst byte array. | [
"AppendUint8",
"encodes",
"and",
"inserts",
"a",
"unsigned",
"int8",
"value",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L251-L253 |
147,344 | rs/zerolog | internal/cbor/types.go | AppendUints8 | func (e Encoder) AppendUints8(dst []byte, vals []uint8) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendUint8(dst, v)
}
return dst
} | go | func (e Encoder) AppendUints8(dst []byte, vals []uint8) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendUint8(dst, v)
}
return dst
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendUints8",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"uint8",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeArray",
"\n",
"l",
":=",
"len",
"(",
"vals",
")",
"\n",
"if",
"l",
"==",
"0",
"{",
"return",
"e",
".",
"AppendArrayEnd",
"(",
"e",
".",
"AppendArrayStart",
"(",
"dst",
")",
")",
"\n",
"}",
"\n",
"if",
"l",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"l",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"l",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"vals",
"{",
"dst",
"=",
"e",
".",
"AppendUint8",
"(",
"dst",
",",
"v",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendUints8 encodes and inserts an array of uint8 values into the dst byte array. | [
"AppendUints8",
"encodes",
"and",
"inserts",
"an",
"array",
"of",
"uint8",
"values",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L256-L272 |
147,345 | rs/zerolog | internal/cbor/types.go | AppendUint16 | func (e Encoder) AppendUint16(dst []byte, val uint16) []byte {
return e.AppendUint(dst, uint(val))
} | go | func (e Encoder) AppendUint16(dst []byte, val uint16) []byte {
return e.AppendUint(dst, uint(val))
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendUint16",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"uint16",
")",
"[",
"]",
"byte",
"{",
"return",
"e",
".",
"AppendUint",
"(",
"dst",
",",
"uint",
"(",
"val",
")",
")",
"\n",
"}"
] | // AppendUint16 encodes and inserts a uint16 value into the dst byte array. | [
"AppendUint16",
"encodes",
"and",
"inserts",
"a",
"uint16",
"value",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L275-L277 |
147,346 | rs/zerolog | internal/cbor/types.go | AppendUints16 | func (e Encoder) AppendUints16(dst []byte, vals []uint16) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendUint16(dst, v)
}
return dst
} | go | func (e Encoder) AppendUints16(dst []byte, vals []uint16) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendUint16(dst, v)
}
return dst
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendUints16",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"uint16",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeArray",
"\n",
"l",
":=",
"len",
"(",
"vals",
")",
"\n",
"if",
"l",
"==",
"0",
"{",
"return",
"e",
".",
"AppendArrayEnd",
"(",
"e",
".",
"AppendArrayStart",
"(",
"dst",
")",
")",
"\n",
"}",
"\n",
"if",
"l",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"l",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"l",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"vals",
"{",
"dst",
"=",
"e",
".",
"AppendUint16",
"(",
"dst",
",",
"v",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendUints16 encodes and inserts an array of uint16 values into the dst byte array. | [
"AppendUints16",
"encodes",
"and",
"inserts",
"an",
"array",
"of",
"uint16",
"values",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L280-L296 |
147,347 | rs/zerolog | internal/cbor/types.go | AppendUint32 | func (e Encoder) AppendUint32(dst []byte, val uint32) []byte {
return e.AppendUint(dst, uint(val))
} | go | func (e Encoder) AppendUint32(dst []byte, val uint32) []byte {
return e.AppendUint(dst, uint(val))
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendUint32",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"uint32",
")",
"[",
"]",
"byte",
"{",
"return",
"e",
".",
"AppendUint",
"(",
"dst",
",",
"uint",
"(",
"val",
")",
")",
"\n",
"}"
] | // AppendUint32 encodes and inserts a uint32 value into the dst byte array. | [
"AppendUint32",
"encodes",
"and",
"inserts",
"a",
"uint32",
"value",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L299-L301 |
147,348 | rs/zerolog | internal/cbor/types.go | AppendUints32 | func (e Encoder) AppendUints32(dst []byte, vals []uint32) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendUint32(dst, v)
}
return dst
} | go | func (e Encoder) AppendUints32(dst []byte, vals []uint32) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendUint32(dst, v)
}
return dst
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendUints32",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"uint32",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeArray",
"\n",
"l",
":=",
"len",
"(",
"vals",
")",
"\n",
"if",
"l",
"==",
"0",
"{",
"return",
"e",
".",
"AppendArrayEnd",
"(",
"e",
".",
"AppendArrayStart",
"(",
"dst",
")",
")",
"\n",
"}",
"\n",
"if",
"l",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"l",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"l",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"vals",
"{",
"dst",
"=",
"e",
".",
"AppendUint32",
"(",
"dst",
",",
"v",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendUints32 encodes and inserts an array of uint32 values into the dst byte array. | [
"AppendUints32",
"encodes",
"and",
"inserts",
"an",
"array",
"of",
"uint32",
"values",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L304-L320 |
147,349 | rs/zerolog | internal/cbor/types.go | AppendUint64 | func (Encoder) AppendUint64(dst []byte, val uint64) []byte {
major := majorTypeUnsignedInt
contentVal := val
if contentVal <= additionalMax {
lb := byte(contentVal)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(contentVal))
}
return dst
} | go | func (Encoder) AppendUint64(dst []byte, val uint64) []byte {
major := majorTypeUnsignedInt
contentVal := val
if contentVal <= additionalMax {
lb := byte(contentVal)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(contentVal))
}
return dst
} | [
"func",
"(",
"Encoder",
")",
"AppendUint64",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"uint64",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeUnsignedInt",
"\n",
"contentVal",
":=",
"val",
"\n",
"if",
"contentVal",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"contentVal",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"contentVal",
")",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendUint64 encodes and inserts a uint64 value into the dst byte array. | [
"AppendUint64",
"encodes",
"and",
"inserts",
"a",
"uint64",
"value",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L323-L333 |
147,350 | rs/zerolog | internal/cbor/types.go | AppendUints64 | func (e Encoder) AppendUints64(dst []byte, vals []uint64) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendUint64(dst, v)
}
return dst
} | go | func (e Encoder) AppendUints64(dst []byte, vals []uint64) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendUint64(dst, v)
}
return dst
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendUints64",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"uint64",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeArray",
"\n",
"l",
":=",
"len",
"(",
"vals",
")",
"\n",
"if",
"l",
"==",
"0",
"{",
"return",
"e",
".",
"AppendArrayEnd",
"(",
"e",
".",
"AppendArrayStart",
"(",
"dst",
")",
")",
"\n",
"}",
"\n",
"if",
"l",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"l",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"l",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"vals",
"{",
"dst",
"=",
"e",
".",
"AppendUint64",
"(",
"dst",
",",
"v",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendUints64 encodes and inserts an array of uint64 values into the dst byte array. | [
"AppendUints64",
"encodes",
"and",
"inserts",
"an",
"array",
"of",
"uint64",
"values",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L336-L352 |
147,351 | rs/zerolog | internal/cbor/types.go | AppendFloat32 | func (Encoder) AppendFloat32(dst []byte, val float32) []byte {
switch {
case math.IsNaN(float64(val)):
return append(dst, "\xfa\x7f\xc0\x00\x00"...)
case math.IsInf(float64(val), 1):
return append(dst, "\xfa\x7f\x80\x00\x00"...)
case math.IsInf(float64(val), -1):
return append(dst, "\xfa\xff\x80\x00\x00"...)
}
major := majorTypeSimpleAndFloat
subType := additionalTypeFloat32
n := math.Float32bits(val)
var buf [4]byte
for i := uint(0); i < 4; i++ {
buf[i] = byte(n >> ((3 - i) * 8))
}
return append(append(dst, byte(major|subType)), buf[0], buf[1], buf[2], buf[3])
} | go | func (Encoder) AppendFloat32(dst []byte, val float32) []byte {
switch {
case math.IsNaN(float64(val)):
return append(dst, "\xfa\x7f\xc0\x00\x00"...)
case math.IsInf(float64(val), 1):
return append(dst, "\xfa\x7f\x80\x00\x00"...)
case math.IsInf(float64(val), -1):
return append(dst, "\xfa\xff\x80\x00\x00"...)
}
major := majorTypeSimpleAndFloat
subType := additionalTypeFloat32
n := math.Float32bits(val)
var buf [4]byte
for i := uint(0); i < 4; i++ {
buf[i] = byte(n >> ((3 - i) * 8))
}
return append(append(dst, byte(major|subType)), buf[0], buf[1], buf[2], buf[3])
} | [
"func",
"(",
"Encoder",
")",
"AppendFloat32",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"float32",
")",
"[",
"]",
"byte",
"{",
"switch",
"{",
"case",
"math",
".",
"IsNaN",
"(",
"float64",
"(",
"val",
")",
")",
":",
"return",
"append",
"(",
"dst",
",",
"\"",
"\\xfa",
"\\x7f",
"\\xc0",
"\\x00",
"\\x00",
"\"",
"...",
")",
"\n",
"case",
"math",
".",
"IsInf",
"(",
"float64",
"(",
"val",
")",
",",
"1",
")",
":",
"return",
"append",
"(",
"dst",
",",
"\"",
"\\xfa",
"\\x7f",
"\\x80",
"\\x00",
"\\x00",
"\"",
"...",
")",
"\n",
"case",
"math",
".",
"IsInf",
"(",
"float64",
"(",
"val",
")",
",",
"-",
"1",
")",
":",
"return",
"append",
"(",
"dst",
",",
"\"",
"\\xfa",
"\\xff",
"\\x80",
"\\x00",
"\\x00",
"\"",
"...",
")",
"\n",
"}",
"\n",
"major",
":=",
"majorTypeSimpleAndFloat",
"\n",
"subType",
":=",
"additionalTypeFloat32",
"\n",
"n",
":=",
"math",
".",
"Float32bits",
"(",
"val",
")",
"\n",
"var",
"buf",
"[",
"4",
"]",
"byte",
"\n",
"for",
"i",
":=",
"uint",
"(",
"0",
")",
";",
"i",
"<",
"4",
";",
"i",
"++",
"{",
"buf",
"[",
"i",
"]",
"=",
"byte",
"(",
"n",
">>",
"(",
"(",
"3",
"-",
"i",
")",
"*",
"8",
")",
")",
"\n",
"}",
"\n",
"return",
"append",
"(",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"subType",
")",
")",
",",
"buf",
"[",
"0",
"]",
",",
"buf",
"[",
"1",
"]",
",",
"buf",
"[",
"2",
"]",
",",
"buf",
"[",
"3",
"]",
")",
"\n",
"}"
] | // AppendFloat32 encodes and inserts a single precision float value into the dst byte array. | [
"AppendFloat32",
"encodes",
"and",
"inserts",
"a",
"single",
"precision",
"float",
"value",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L355-L372 |
147,352 | rs/zerolog | internal/cbor/types.go | AppendFloats32 | func (e Encoder) AppendFloats32(dst []byte, vals []float32) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendFloat32(dst, v)
}
return dst
} | go | func (e Encoder) AppendFloats32(dst []byte, vals []float32) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendFloat32(dst, v)
}
return dst
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendFloats32",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"float32",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeArray",
"\n",
"l",
":=",
"len",
"(",
"vals",
")",
"\n",
"if",
"l",
"==",
"0",
"{",
"return",
"e",
".",
"AppendArrayEnd",
"(",
"e",
".",
"AppendArrayStart",
"(",
"dst",
")",
")",
"\n",
"}",
"\n",
"if",
"l",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"l",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"l",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"vals",
"{",
"dst",
"=",
"e",
".",
"AppendFloat32",
"(",
"dst",
",",
"v",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendFloats32 encodes and inserts an array of single precision float value into the dst byte array. | [
"AppendFloats32",
"encodes",
"and",
"inserts",
"an",
"array",
"of",
"single",
"precision",
"float",
"value",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L375-L391 |
147,353 | rs/zerolog | internal/cbor/types.go | AppendFloat64 | func (Encoder) AppendFloat64(dst []byte, val float64) []byte {
switch {
case math.IsNaN(val):
return append(dst, "\xfb\x7f\xf8\x00\x00\x00\x00\x00\x00"...)
case math.IsInf(val, 1):
return append(dst, "\xfb\x7f\xf0\x00\x00\x00\x00\x00\x00"...)
case math.IsInf(val, -1):
return append(dst, "\xfb\xff\xf0\x00\x00\x00\x00\x00\x00"...)
}
major := majorTypeSimpleAndFloat
subType := additionalTypeFloat64
n := math.Float64bits(val)
dst = append(dst, byte(major|subType))
for i := uint(1); i <= 8; i++ {
b := byte(n >> ((8 - i) * 8))
dst = append(dst, b)
}
return dst
} | go | func (Encoder) AppendFloat64(dst []byte, val float64) []byte {
switch {
case math.IsNaN(val):
return append(dst, "\xfb\x7f\xf8\x00\x00\x00\x00\x00\x00"...)
case math.IsInf(val, 1):
return append(dst, "\xfb\x7f\xf0\x00\x00\x00\x00\x00\x00"...)
case math.IsInf(val, -1):
return append(dst, "\xfb\xff\xf0\x00\x00\x00\x00\x00\x00"...)
}
major := majorTypeSimpleAndFloat
subType := additionalTypeFloat64
n := math.Float64bits(val)
dst = append(dst, byte(major|subType))
for i := uint(1); i <= 8; i++ {
b := byte(n >> ((8 - i) * 8))
dst = append(dst, b)
}
return dst
} | [
"func",
"(",
"Encoder",
")",
"AppendFloat64",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"float64",
")",
"[",
"]",
"byte",
"{",
"switch",
"{",
"case",
"math",
".",
"IsNaN",
"(",
"val",
")",
":",
"return",
"append",
"(",
"dst",
",",
"\"",
"\\xfb",
"\\x7f",
"\\xf8",
"\\x00",
"\\x00",
"\\x00",
"\\x00",
"\\x00",
"\\x00",
"\"",
"...",
")",
"\n",
"case",
"math",
".",
"IsInf",
"(",
"val",
",",
"1",
")",
":",
"return",
"append",
"(",
"dst",
",",
"\"",
"\\xfb",
"\\x7f",
"\\xf0",
"\\x00",
"\\x00",
"\\x00",
"\\x00",
"\\x00",
"\\x00",
"\"",
"...",
")",
"\n",
"case",
"math",
".",
"IsInf",
"(",
"val",
",",
"-",
"1",
")",
":",
"return",
"append",
"(",
"dst",
",",
"\"",
"\\xfb",
"\\xff",
"\\xf0",
"\\x00",
"\\x00",
"\\x00",
"\\x00",
"\\x00",
"\\x00",
"\"",
"...",
")",
"\n",
"}",
"\n",
"major",
":=",
"majorTypeSimpleAndFloat",
"\n",
"subType",
":=",
"additionalTypeFloat64",
"\n",
"n",
":=",
"math",
".",
"Float64bits",
"(",
"val",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"subType",
")",
")",
"\n",
"for",
"i",
":=",
"uint",
"(",
"1",
")",
";",
"i",
"<=",
"8",
";",
"i",
"++",
"{",
"b",
":=",
"byte",
"(",
"n",
">>",
"(",
"(",
"8",
"-",
"i",
")",
"*",
"8",
")",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"b",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendFloat64 encodes and inserts a double precision float value into the dst byte array. | [
"AppendFloat64",
"encodes",
"and",
"inserts",
"a",
"double",
"precision",
"float",
"value",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L394-L412 |
147,354 | rs/zerolog | internal/cbor/types.go | AppendFloats64 | func (e Encoder) AppendFloats64(dst []byte, vals []float64) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendFloat64(dst, v)
}
return dst
} | go | func (e Encoder) AppendFloats64(dst []byte, vals []float64) []byte {
major := majorTypeArray
l := len(vals)
if l == 0 {
return e.AppendArrayEnd(e.AppendArrayStart(dst))
}
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendFloat64(dst, v)
}
return dst
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendFloats64",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"float64",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeArray",
"\n",
"l",
":=",
"len",
"(",
"vals",
")",
"\n",
"if",
"l",
"==",
"0",
"{",
"return",
"e",
".",
"AppendArrayEnd",
"(",
"e",
".",
"AppendArrayStart",
"(",
"dst",
")",
")",
"\n",
"}",
"\n",
"if",
"l",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"l",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"l",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"vals",
"{",
"dst",
"=",
"e",
".",
"AppendFloat64",
"(",
"dst",
",",
"v",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendFloats64 encodes and inserts an array of double precision float values into the dst byte array. | [
"AppendFloats64",
"encodes",
"and",
"inserts",
"an",
"array",
"of",
"double",
"precision",
"float",
"values",
"into",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L415-L431 |
147,355 | rs/zerolog | internal/cbor/types.go | AppendInterface | func (e Encoder) AppendInterface(dst []byte, i interface{}) []byte {
marshaled, err := json.Marshal(i)
if err != nil {
return e.AppendString(dst, fmt.Sprintf("marshaling error: %v", err))
}
return AppendEmbeddedJSON(dst, marshaled)
} | go | func (e Encoder) AppendInterface(dst []byte, i interface{}) []byte {
marshaled, err := json.Marshal(i)
if err != nil {
return e.AppendString(dst, fmt.Sprintf("marshaling error: %v", err))
}
return AppendEmbeddedJSON(dst, marshaled)
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendInterface",
"(",
"dst",
"[",
"]",
"byte",
",",
"i",
"interface",
"{",
"}",
")",
"[",
"]",
"byte",
"{",
"marshaled",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"i",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"e",
".",
"AppendString",
"(",
"dst",
",",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"err",
")",
")",
"\n",
"}",
"\n",
"return",
"AppendEmbeddedJSON",
"(",
"dst",
",",
"marshaled",
")",
"\n",
"}"
] | // AppendInterface takes an arbitrary object and converts it to JSON and embeds it dst. | [
"AppendInterface",
"takes",
"an",
"arbitrary",
"object",
"and",
"converts",
"it",
"to",
"JSON",
"and",
"embeds",
"it",
"dst",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L434-L440 |
147,356 | rs/zerolog | internal/cbor/types.go | AppendHex | func (e Encoder) AppendHex(dst []byte, val []byte) []byte {
dst = append(dst, byte(majorTypeTags|additionalTypeIntUint16))
dst = append(dst, byte(additionalTypeTagHexString>>8))
dst = append(dst, byte(additionalTypeTagHexString&0xff))
return e.AppendBytes(dst, val)
} | go | func (e Encoder) AppendHex(dst []byte, val []byte) []byte {
dst = append(dst, byte(majorTypeTags|additionalTypeIntUint16))
dst = append(dst, byte(additionalTypeTagHexString>>8))
dst = append(dst, byte(additionalTypeTagHexString&0xff))
return e.AppendBytes(dst, val)
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendHex",
"(",
"dst",
"[",
"]",
"byte",
",",
"val",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"majorTypeTags",
"|",
"additionalTypeIntUint16",
")",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"additionalTypeTagHexString",
">>",
"8",
")",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"additionalTypeTagHexString",
"&",
"0xff",
")",
")",
"\n",
"return",
"e",
".",
"AppendBytes",
"(",
"dst",
",",
"val",
")",
"\n",
"}"
] | // AppendHex adds a TAG and inserts a hex bytes as a string. | [
"AppendHex",
"adds",
"a",
"TAG",
"and",
"inserts",
"a",
"hex",
"bytes",
"as",
"a",
"string",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/types.go#L473-L478 |
147,357 | rs/zerolog | writer.go | WriteLevel | func (s *syncWriter) WriteLevel(l Level, p []byte) (n int, err error) {
s.mu.Lock()
defer s.mu.Unlock()
return s.lw.WriteLevel(l, p)
} | go | func (s *syncWriter) WriteLevel(l Level, p []byte) (n int, err error) {
s.mu.Lock()
defer s.mu.Unlock()
return s.lw.WriteLevel(l, p)
} | [
"func",
"(",
"s",
"*",
"syncWriter",
")",
"WriteLevel",
"(",
"l",
"Level",
",",
"p",
"[",
"]",
"byte",
")",
"(",
"n",
"int",
",",
"err",
"error",
")",
"{",
"s",
".",
"mu",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"mu",
".",
"Unlock",
"(",
")",
"\n",
"return",
"s",
".",
"lw",
".",
"WriteLevel",
"(",
"l",
",",
"p",
")",
"\n",
"}"
] | // WriteLevel implements the LevelWriter interface. | [
"WriteLevel",
"implements",
"the",
"LevelWriter",
"interface",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/writer.go#L49-L53 |
147,358 | rs/zerolog | internal/cbor/string.go | AppendStrings | func (e Encoder) AppendStrings(dst []byte, vals []string) []byte {
major := majorTypeArray
l := len(vals)
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendString(dst, v)
}
return dst
} | go | func (e Encoder) AppendStrings(dst []byte, vals []string) []byte {
major := majorTypeArray
l := len(vals)
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
for _, v := range vals {
dst = e.AppendString(dst, v)
}
return dst
} | [
"func",
"(",
"e",
"Encoder",
")",
"AppendStrings",
"(",
"dst",
"[",
"]",
"byte",
",",
"vals",
"[",
"]",
"string",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeArray",
"\n",
"l",
":=",
"len",
"(",
"vals",
")",
"\n",
"if",
"l",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"l",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"l",
")",
")",
"\n",
"}",
"\n",
"for",
"_",
",",
"v",
":=",
"range",
"vals",
"{",
"dst",
"=",
"e",
".",
"AppendString",
"(",
"dst",
",",
"v",
")",
"\n",
"}",
"\n",
"return",
"dst",
"\n",
"}"
] | // AppendStrings encodes and adds an array of strings to the dst byte array. | [
"AppendStrings",
"encodes",
"and",
"adds",
"an",
"array",
"of",
"strings",
"to",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/string.go#L4-L17 |
147,359 | rs/zerolog | internal/cbor/string.go | AppendString | func (Encoder) AppendString(dst []byte, s string) []byte {
major := majorTypeUtf8String
l := len(s)
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, majorTypeUtf8String, uint64(l))
}
return append(dst, s...)
} | go | func (Encoder) AppendString(dst []byte, s string) []byte {
major := majorTypeUtf8String
l := len(s)
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, majorTypeUtf8String, uint64(l))
}
return append(dst, s...)
} | [
"func",
"(",
"Encoder",
")",
"AppendString",
"(",
"dst",
"[",
"]",
"byte",
",",
"s",
"string",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeUtf8String",
"\n\n",
"l",
":=",
"len",
"(",
"s",
")",
"\n",
"if",
"l",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"l",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"majorTypeUtf8String",
",",
"uint64",
"(",
"l",
")",
")",
"\n",
"}",
"\n",
"return",
"append",
"(",
"dst",
",",
"s",
"...",
")",
"\n",
"}"
] | // AppendString encodes and adds a string to the dst byte array. | [
"AppendString",
"encodes",
"and",
"adds",
"a",
"string",
"to",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/string.go#L20-L31 |
147,360 | rs/zerolog | internal/cbor/string.go | AppendBytes | func (Encoder) AppendBytes(dst, s []byte) []byte {
major := majorTypeByteString
l := len(s)
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
return append(dst, s...)
} | go | func (Encoder) AppendBytes(dst, s []byte) []byte {
major := majorTypeByteString
l := len(s)
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
return append(dst, s...)
} | [
"func",
"(",
"Encoder",
")",
"AppendBytes",
"(",
"dst",
",",
"s",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeByteString",
"\n\n",
"l",
":=",
"len",
"(",
"s",
")",
"\n",
"if",
"l",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"l",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"l",
")",
")",
"\n",
"}",
"\n",
"return",
"append",
"(",
"dst",
",",
"s",
"...",
")",
"\n",
"}"
] | // AppendBytes encodes and adds an array of bytes to the dst byte array. | [
"AppendBytes",
"encodes",
"and",
"adds",
"an",
"array",
"of",
"bytes",
"to",
"the",
"dst",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/string.go#L34-L45 |
147,361 | rs/zerolog | internal/cbor/string.go | AppendEmbeddedJSON | func AppendEmbeddedJSON(dst, s []byte) []byte {
major := majorTypeTags
minor := additionalTypeEmbeddedJSON
// Append the TAG to indicate this is Embedded JSON.
dst = append(dst, byte(major|additionalTypeIntUint16))
dst = append(dst, byte(minor>>8))
dst = append(dst, byte(minor&0xff))
// Append the JSON Object as Byte String.
major = majorTypeByteString
l := len(s)
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
return append(dst, s...)
} | go | func AppendEmbeddedJSON(dst, s []byte) []byte {
major := majorTypeTags
minor := additionalTypeEmbeddedJSON
// Append the TAG to indicate this is Embedded JSON.
dst = append(dst, byte(major|additionalTypeIntUint16))
dst = append(dst, byte(minor>>8))
dst = append(dst, byte(minor&0xff))
// Append the JSON Object as Byte String.
major = majorTypeByteString
l := len(s)
if l <= additionalMax {
lb := byte(l)
dst = append(dst, byte(major|lb))
} else {
dst = appendCborTypePrefix(dst, major, uint64(l))
}
return append(dst, s...)
} | [
"func",
"AppendEmbeddedJSON",
"(",
"dst",
",",
"s",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"major",
":=",
"majorTypeTags",
"\n",
"minor",
":=",
"additionalTypeEmbeddedJSON",
"\n\n",
"// Append the TAG to indicate this is Embedded JSON.",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"additionalTypeIntUint16",
")",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"minor",
">>",
"8",
")",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"minor",
"&",
"0xff",
")",
")",
"\n\n",
"// Append the JSON Object as Byte String.",
"major",
"=",
"majorTypeByteString",
"\n\n",
"l",
":=",
"len",
"(",
"s",
")",
"\n",
"if",
"l",
"<=",
"additionalMax",
"{",
"lb",
":=",
"byte",
"(",
"l",
")",
"\n",
"dst",
"=",
"append",
"(",
"dst",
",",
"byte",
"(",
"major",
"|",
"lb",
")",
")",
"\n",
"}",
"else",
"{",
"dst",
"=",
"appendCborTypePrefix",
"(",
"dst",
",",
"major",
",",
"uint64",
"(",
"l",
")",
")",
"\n",
"}",
"\n",
"return",
"append",
"(",
"dst",
",",
"s",
"...",
")",
"\n",
"}"
] | // AppendEmbeddedJSON adds a tag and embeds input JSON as such. | [
"AppendEmbeddedJSON",
"adds",
"a",
"tag",
"and",
"embeds",
"input",
"JSON",
"as",
"such",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/string.go#L48-L68 |
147,362 | rs/zerolog | ctx.go | Ctx | func Ctx(ctx context.Context) *Logger {
if l, ok := ctx.Value(ctxKey{}).(*Logger); ok {
return l
}
return disabledLogger
} | go | func Ctx(ctx context.Context) *Logger {
if l, ok := ctx.Value(ctxKey{}).(*Logger); ok {
return l
}
return disabledLogger
} | [
"func",
"Ctx",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"Logger",
"{",
"if",
"l",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKey",
"{",
"}",
")",
".",
"(",
"*",
"Logger",
")",
";",
"ok",
"{",
"return",
"l",
"\n",
"}",
"\n",
"return",
"disabledLogger",
"\n",
"}"
] | // Ctx returns the Logger associated with the ctx. If no logger
// is associated, a disabled logger is returned. | [
"Ctx",
"returns",
"the",
"Logger",
"associated",
"with",
"the",
"ctx",
".",
"If",
"no",
"logger",
"is",
"associated",
"a",
"disabled",
"logger",
"is",
"returned",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/ctx.go#L42-L47 |
147,363 | rs/zerolog | internal/cbor/decode_stream.go | DecodeObjectToStr | func DecodeObjectToStr(in []byte) string {
if binaryFmt(in) {
var b bytes.Buffer
cbor2JsonOneObject(getReader(string(in)), &b)
return b.String()
}
return string(in)
} | go | func DecodeObjectToStr(in []byte) string {
if binaryFmt(in) {
var b bytes.Buffer
cbor2JsonOneObject(getReader(string(in)), &b)
return b.String()
}
return string(in)
} | [
"func",
"DecodeObjectToStr",
"(",
"in",
"[",
"]",
"byte",
")",
"string",
"{",
"if",
"binaryFmt",
"(",
"in",
")",
"{",
"var",
"b",
"bytes",
".",
"Buffer",
"\n",
"cbor2JsonOneObject",
"(",
"getReader",
"(",
"string",
"(",
"in",
")",
")",
",",
"&",
"b",
")",
"\n",
"return",
"b",
".",
"String",
"(",
")",
"\n",
"}",
"\n",
"return",
"string",
"(",
"in",
")",
"\n",
"}"
] | // DecodeObjectToStr checks if the input is a binary format, if so,
// it will decode a single Object and return the decoded string. | [
"DecodeObjectToStr",
"checks",
"if",
"the",
"input",
"is",
"a",
"binary",
"format",
"if",
"so",
"it",
"will",
"decode",
"a",
"single",
"Object",
"and",
"return",
"the",
"decoded",
"string",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/decode_stream.go#L596-L603 |
147,364 | rs/zerolog | internal/cbor/decode_stream.go | DecodeIfBinaryToBytes | func DecodeIfBinaryToBytes(in []byte) []byte {
if binaryFmt(in) {
var b bytes.Buffer
Cbor2JsonManyObjects(bytes.NewReader(in), &b)
return b.Bytes()
}
return in
} | go | func DecodeIfBinaryToBytes(in []byte) []byte {
if binaryFmt(in) {
var b bytes.Buffer
Cbor2JsonManyObjects(bytes.NewReader(in), &b)
return b.Bytes()
}
return in
} | [
"func",
"DecodeIfBinaryToBytes",
"(",
"in",
"[",
"]",
"byte",
")",
"[",
"]",
"byte",
"{",
"if",
"binaryFmt",
"(",
"in",
")",
"{",
"var",
"b",
"bytes",
".",
"Buffer",
"\n",
"Cbor2JsonManyObjects",
"(",
"bytes",
".",
"NewReader",
"(",
"in",
")",
",",
"&",
"b",
")",
"\n",
"return",
"b",
".",
"Bytes",
"(",
")",
"\n",
"}",
"\n",
"return",
"in",
"\n",
"}"
] | // DecodeIfBinaryToBytes checks if the input is a binary format, if so,
// it will decode all Objects and return the decoded string as byte array. | [
"DecodeIfBinaryToBytes",
"checks",
"if",
"the",
"input",
"is",
"a",
"binary",
"format",
"if",
"so",
"it",
"will",
"decode",
"all",
"Objects",
"and",
"return",
"the",
"decoded",
"string",
"as",
"byte",
"array",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/internal/cbor/decode_stream.go#L607-L614 |
147,365 | rs/zerolog | cmd/lint/lint.go | init | func init() {
flag.Var(&recursivelyIgnoredPkgs, "ignorePkgRecursively", "ignore the specified package and all subpackages recursively")
flag.Var(&ignoredPkgs, "ignorePkg", "ignore the specified package")
flag.Var(&ignoredFiles, "ignoreFile", "ignore the specified file by its path and/or go path (package/file.go)")
flag.Var(&allowedFinishers, "finisher", "allowed finisher for the event chain")
flag.Parse()
// add zerolog to recursively ignored packages
recursivelyIgnoredPkgs = append(recursivelyIgnoredPkgs, "github.com/rs/zerolog")
args := flag.Args()
if len(args) != 1 {
fmt.Fprintln(os.Stderr, "you must provide exactly one package path")
os.Exit(1)
}
rootPkg = args[0]
} | go | func init() {
flag.Var(&recursivelyIgnoredPkgs, "ignorePkgRecursively", "ignore the specified package and all subpackages recursively")
flag.Var(&ignoredPkgs, "ignorePkg", "ignore the specified package")
flag.Var(&ignoredFiles, "ignoreFile", "ignore the specified file by its path and/or go path (package/file.go)")
flag.Var(&allowedFinishers, "finisher", "allowed finisher for the event chain")
flag.Parse()
// add zerolog to recursively ignored packages
recursivelyIgnoredPkgs = append(recursivelyIgnoredPkgs, "github.com/rs/zerolog")
args := flag.Args()
if len(args) != 1 {
fmt.Fprintln(os.Stderr, "you must provide exactly one package path")
os.Exit(1)
}
rootPkg = args[0]
} | [
"func",
"init",
"(",
")",
"{",
"flag",
".",
"Var",
"(",
"&",
"recursivelyIgnoredPkgs",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"flag",
".",
"Var",
"(",
"&",
"ignoredPkgs",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"flag",
".",
"Var",
"(",
"&",
"ignoredFiles",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"flag",
".",
"Var",
"(",
"&",
"allowedFinishers",
",",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"flag",
".",
"Parse",
"(",
")",
"\n\n",
"// add zerolog to recursively ignored packages",
"recursivelyIgnoredPkgs",
"=",
"append",
"(",
"recursivelyIgnoredPkgs",
",",
"\"",
"\"",
")",
"\n",
"args",
":=",
"flag",
".",
"Args",
"(",
")",
"\n",
"if",
"len",
"(",
"args",
")",
"!=",
"1",
"{",
"fmt",
".",
"Fprintln",
"(",
"os",
".",
"Stderr",
",",
"\"",
"\"",
")",
"\n",
"os",
".",
"Exit",
"(",
"1",
")",
"\n",
"}",
"\n",
"rootPkg",
"=",
"args",
"[",
"0",
"]",
"\n",
"}"
] | // parse input flags and args | [
"parse",
"input",
"flags",
"and",
"args"
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/cmd/lint/lint.go#L25-L40 |
147,366 | rs/zerolog | diode/diode.go | Close | func (dw Writer) Close() error {
dw.c()
<-dw.done
if w, ok := dw.w.(io.Closer); ok {
return w.Close()
}
return nil
} | go | func (dw Writer) Close() error {
dw.c()
<-dw.done
if w, ok := dw.w.(io.Closer); ok {
return w.Close()
}
return nil
} | [
"func",
"(",
"dw",
"Writer",
")",
"Close",
"(",
")",
"error",
"{",
"dw",
".",
"c",
"(",
")",
"\n",
"<-",
"dw",
".",
"done",
"\n",
"if",
"w",
",",
"ok",
":=",
"dw",
".",
"w",
".",
"(",
"io",
".",
"Closer",
")",
";",
"ok",
"{",
"return",
"w",
".",
"Close",
"(",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] | // Close releases the diode poller and call Close on the wrapped writer if
// io.Closer is implemented. | [
"Close",
"releases",
"the",
"diode",
"poller",
"and",
"call",
"Close",
"on",
"the",
"wrapped",
"writer",
"if",
"io",
".",
"Closer",
"is",
"implemented",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/diode/diode.go#L84-L91 |
147,367 | rs/zerolog | context.go | Dict | func (c Context) Dict(key string, dict *Event) Context {
dict.buf = enc.AppendEndMarker(dict.buf)
c.l.context = append(enc.AppendKey(c.l.context, key), dict.buf...)
putEvent(dict)
return c
} | go | func (c Context) Dict(key string, dict *Event) Context {
dict.buf = enc.AppendEndMarker(dict.buf)
c.l.context = append(enc.AppendKey(c.l.context, key), dict.buf...)
putEvent(dict)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Dict",
"(",
"key",
"string",
",",
"dict",
"*",
"Event",
")",
"Context",
"{",
"dict",
".",
"buf",
"=",
"enc",
".",
"AppendEndMarker",
"(",
"dict",
".",
"buf",
")",
"\n",
"c",
".",
"l",
".",
"context",
"=",
"append",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"dict",
".",
"buf",
"...",
")",
"\n",
"putEvent",
"(",
"dict",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Dict adds the field key with the dict to the logger context. | [
"Dict",
"adds",
"the",
"field",
"key",
"with",
"the",
"dict",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L27-L32 |
147,368 | rs/zerolog | context.go | EmbedObject | func (c Context) EmbedObject(obj LogObjectMarshaler) Context {
e := newEvent(levelWriterAdapter{ioutil.Discard}, 0)
e.EmbedObject(obj)
c.l.context = enc.AppendObjectData(c.l.context, e.buf)
putEvent(e)
return c
} | go | func (c Context) EmbedObject(obj LogObjectMarshaler) Context {
e := newEvent(levelWriterAdapter{ioutil.Discard}, 0)
e.EmbedObject(obj)
c.l.context = enc.AppendObjectData(c.l.context, e.buf)
putEvent(e)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"EmbedObject",
"(",
"obj",
"LogObjectMarshaler",
")",
"Context",
"{",
"e",
":=",
"newEvent",
"(",
"levelWriterAdapter",
"{",
"ioutil",
".",
"Discard",
"}",
",",
"0",
")",
"\n",
"e",
".",
"EmbedObject",
"(",
"obj",
")",
"\n",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendObjectData",
"(",
"c",
".",
"l",
".",
"context",
",",
"e",
".",
"buf",
")",
"\n",
"putEvent",
"(",
"e",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // EmbedObject marshals and Embeds an object that implement the LogObjectMarshaler interface. | [
"EmbedObject",
"marshals",
"and",
"Embeds",
"an",
"object",
"that",
"implement",
"the",
"LogObjectMarshaler",
"interface",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L64-L70 |
147,369 | rs/zerolog | context.go | Str | func (c Context) Str(key, val string) Context {
c.l.context = enc.AppendString(enc.AppendKey(c.l.context, key), val)
return c
} | go | func (c Context) Str(key, val string) Context {
c.l.context = enc.AppendString(enc.AppendKey(c.l.context, key), val)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Str",
"(",
"key",
",",
"val",
"string",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendString",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"val",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Str adds the field key with val as a string to the logger context. | [
"Str",
"adds",
"the",
"field",
"key",
"with",
"val",
"as",
"a",
"string",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L73-L76 |
147,370 | rs/zerolog | context.go | Strs | func (c Context) Strs(key string, vals []string) Context {
c.l.context = enc.AppendStrings(enc.AppendKey(c.l.context, key), vals)
return c
} | go | func (c Context) Strs(key string, vals []string) Context {
c.l.context = enc.AppendStrings(enc.AppendKey(c.l.context, key), vals)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Strs",
"(",
"key",
"string",
",",
"vals",
"[",
"]",
"string",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendStrings",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"vals",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Strs adds the field key with val as a string to the logger context. | [
"Strs",
"adds",
"the",
"field",
"key",
"with",
"val",
"as",
"a",
"string",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L79-L82 |
147,371 | rs/zerolog | context.go | Hex | func (c Context) Hex(key string, val []byte) Context {
c.l.context = enc.AppendHex(enc.AppendKey(c.l.context, key), val)
return c
} | go | func (c Context) Hex(key string, val []byte) Context {
c.l.context = enc.AppendHex(enc.AppendKey(c.l.context, key), val)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Hex",
"(",
"key",
"string",
",",
"val",
"[",
"]",
"byte",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendHex",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"val",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Hex adds the field key with val as a hex string to the logger context. | [
"Hex",
"adds",
"the",
"field",
"key",
"with",
"val",
"as",
"a",
"hex",
"string",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L91-L94 |
147,372 | rs/zerolog | context.go | RawJSON | func (c Context) RawJSON(key string, b []byte) Context {
c.l.context = appendJSON(enc.AppendKey(c.l.context, key), b)
return c
} | go | func (c Context) RawJSON(key string, b []byte) Context {
c.l.context = appendJSON(enc.AppendKey(c.l.context, key), b)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"RawJSON",
"(",
"key",
"string",
",",
"b",
"[",
"]",
"byte",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"appendJSON",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"b",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // RawJSON adds already encoded JSON to context.
//
// No sanity check is performed on b; it must not contain carriage returns and
// be valid JSON. | [
"RawJSON",
"adds",
"already",
"encoded",
"JSON",
"to",
"context",
".",
"No",
"sanity",
"check",
"is",
"performed",
"on",
"b",
";",
"it",
"must",
"not",
"contain",
"carriage",
"returns",
"and",
"be",
"valid",
"JSON",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L100-L103 |
147,373 | rs/zerolog | context.go | AnErr | func (c Context) AnErr(key string, err error) Context {
marshaled := ErrorMarshalFunc(err)
switch m := marshaled.(type) {
case nil:
return c
case LogObjectMarshaler:
return c.Object(key, m)
case error:
return c.Str(key, m.Error())
case string:
return c.Str(key, m)
default:
return c.Interface(key, m)
}
} | go | func (c Context) AnErr(key string, err error) Context {
marshaled := ErrorMarshalFunc(err)
switch m := marshaled.(type) {
case nil:
return c
case LogObjectMarshaler:
return c.Object(key, m)
case error:
return c.Str(key, m.Error())
case string:
return c.Str(key, m)
default:
return c.Interface(key, m)
}
} | [
"func",
"(",
"c",
"Context",
")",
"AnErr",
"(",
"key",
"string",
",",
"err",
"error",
")",
"Context",
"{",
"marshaled",
":=",
"ErrorMarshalFunc",
"(",
"err",
")",
"\n",
"switch",
"m",
":=",
"marshaled",
".",
"(",
"type",
")",
"{",
"case",
"nil",
":",
"return",
"c",
"\n",
"case",
"LogObjectMarshaler",
":",
"return",
"c",
".",
"Object",
"(",
"key",
",",
"m",
")",
"\n",
"case",
"error",
":",
"return",
"c",
".",
"Str",
"(",
"key",
",",
"m",
".",
"Error",
"(",
")",
")",
"\n",
"case",
"string",
":",
"return",
"c",
".",
"Str",
"(",
"key",
",",
"m",
")",
"\n",
"default",
":",
"return",
"c",
".",
"Interface",
"(",
"key",
",",
"m",
")",
"\n",
"}",
"\n",
"}"
] | // AnErr adds the field key with serialized err to the logger context. | [
"AnErr",
"adds",
"the",
"field",
"key",
"with",
"serialized",
"err",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L106-L120 |
147,374 | rs/zerolog | context.go | Errs | func (c Context) Errs(key string, errs []error) Context {
arr := Arr()
for _, err := range errs {
marshaled := ErrorMarshalFunc(err)
switch m := marshaled.(type) {
case LogObjectMarshaler:
arr = arr.Object(m)
case error:
arr = arr.Str(m.Error())
case string:
arr = arr.Str(m)
default:
arr = arr.Interface(m)
}
}
return c.Array(key, arr)
} | go | func (c Context) Errs(key string, errs []error) Context {
arr := Arr()
for _, err := range errs {
marshaled := ErrorMarshalFunc(err)
switch m := marshaled.(type) {
case LogObjectMarshaler:
arr = arr.Object(m)
case error:
arr = arr.Str(m.Error())
case string:
arr = arr.Str(m)
default:
arr = arr.Interface(m)
}
}
return c.Array(key, arr)
} | [
"func",
"(",
"c",
"Context",
")",
"Errs",
"(",
"key",
"string",
",",
"errs",
"[",
"]",
"error",
")",
"Context",
"{",
"arr",
":=",
"Arr",
"(",
")",
"\n",
"for",
"_",
",",
"err",
":=",
"range",
"errs",
"{",
"marshaled",
":=",
"ErrorMarshalFunc",
"(",
"err",
")",
"\n",
"switch",
"m",
":=",
"marshaled",
".",
"(",
"type",
")",
"{",
"case",
"LogObjectMarshaler",
":",
"arr",
"=",
"arr",
".",
"Object",
"(",
"m",
")",
"\n",
"case",
"error",
":",
"arr",
"=",
"arr",
".",
"Str",
"(",
"m",
".",
"Error",
"(",
")",
")",
"\n",
"case",
"string",
":",
"arr",
"=",
"arr",
".",
"Str",
"(",
"m",
")",
"\n",
"default",
":",
"arr",
"=",
"arr",
".",
"Interface",
"(",
"m",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"c",
".",
"Array",
"(",
"key",
",",
"arr",
")",
"\n",
"}"
] | // Errs adds the field key with errs as an array of serialized errors to the
// logger context. | [
"Errs",
"adds",
"the",
"field",
"key",
"with",
"errs",
"as",
"an",
"array",
"of",
"serialized",
"errors",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L124-L141 |
147,375 | rs/zerolog | context.go | Err | func (c Context) Err(err error) Context {
return c.AnErr(ErrorFieldName, err)
} | go | func (c Context) Err(err error) Context {
return c.AnErr(ErrorFieldName, err)
} | [
"func",
"(",
"c",
"Context",
")",
"Err",
"(",
"err",
"error",
")",
"Context",
"{",
"return",
"c",
".",
"AnErr",
"(",
"ErrorFieldName",
",",
"err",
")",
"\n",
"}"
] | // Err adds the field "error" with serialized err to the logger context. | [
"Err",
"adds",
"the",
"field",
"error",
"with",
"serialized",
"err",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L144-L146 |
147,376 | rs/zerolog | context.go | Bool | func (c Context) Bool(key string, b bool) Context {
c.l.context = enc.AppendBool(enc.AppendKey(c.l.context, key), b)
return c
} | go | func (c Context) Bool(key string, b bool) Context {
c.l.context = enc.AppendBool(enc.AppendKey(c.l.context, key), b)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Bool",
"(",
"key",
"string",
",",
"b",
"bool",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendBool",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"b",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Bool adds the field key with val as a bool to the logger context. | [
"Bool",
"adds",
"the",
"field",
"key",
"with",
"val",
"as",
"a",
"bool",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L149-L152 |
147,377 | rs/zerolog | context.go | Int | func (c Context) Int(key string, i int) Context {
c.l.context = enc.AppendInt(enc.AppendKey(c.l.context, key), i)
return c
} | go | func (c Context) Int(key string, i int) Context {
c.l.context = enc.AppendInt(enc.AppendKey(c.l.context, key), i)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Int",
"(",
"key",
"string",
",",
"i",
"int",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendInt",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"i",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Int adds the field key with i as a int to the logger context. | [
"Int",
"adds",
"the",
"field",
"key",
"with",
"i",
"as",
"a",
"int",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L161-L164 |
147,378 | rs/zerolog | context.go | Int8 | func (c Context) Int8(key string, i int8) Context {
c.l.context = enc.AppendInt8(enc.AppendKey(c.l.context, key), i)
return c
} | go | func (c Context) Int8(key string, i int8) Context {
c.l.context = enc.AppendInt8(enc.AppendKey(c.l.context, key), i)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Int8",
"(",
"key",
"string",
",",
"i",
"int8",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendInt8",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"i",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Int8 adds the field key with i as a int8 to the logger context. | [
"Int8",
"adds",
"the",
"field",
"key",
"with",
"i",
"as",
"a",
"int8",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L173-L176 |
147,379 | rs/zerolog | context.go | Int16 | func (c Context) Int16(key string, i int16) Context {
c.l.context = enc.AppendInt16(enc.AppendKey(c.l.context, key), i)
return c
} | go | func (c Context) Int16(key string, i int16) Context {
c.l.context = enc.AppendInt16(enc.AppendKey(c.l.context, key), i)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Int16",
"(",
"key",
"string",
",",
"i",
"int16",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendInt16",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"i",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Int16 adds the field key with i as a int16 to the logger context. | [
"Int16",
"adds",
"the",
"field",
"key",
"with",
"i",
"as",
"a",
"int16",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L185-L188 |
147,380 | rs/zerolog | context.go | Int32 | func (c Context) Int32(key string, i int32) Context {
c.l.context = enc.AppendInt32(enc.AppendKey(c.l.context, key), i)
return c
} | go | func (c Context) Int32(key string, i int32) Context {
c.l.context = enc.AppendInt32(enc.AppendKey(c.l.context, key), i)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Int32",
"(",
"key",
"string",
",",
"i",
"int32",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendInt32",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"i",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Int32 adds the field key with i as a int32 to the logger context. | [
"Int32",
"adds",
"the",
"field",
"key",
"with",
"i",
"as",
"a",
"int32",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L197-L200 |
147,381 | rs/zerolog | context.go | Int64 | func (c Context) Int64(key string, i int64) Context {
c.l.context = enc.AppendInt64(enc.AppendKey(c.l.context, key), i)
return c
} | go | func (c Context) Int64(key string, i int64) Context {
c.l.context = enc.AppendInt64(enc.AppendKey(c.l.context, key), i)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Int64",
"(",
"key",
"string",
",",
"i",
"int64",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendInt64",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"i",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Int64 adds the field key with i as a int64 to the logger context. | [
"Int64",
"adds",
"the",
"field",
"key",
"with",
"i",
"as",
"a",
"int64",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L209-L212 |
147,382 | rs/zerolog | context.go | Uint | func (c Context) Uint(key string, i uint) Context {
c.l.context = enc.AppendUint(enc.AppendKey(c.l.context, key), i)
return c
} | go | func (c Context) Uint(key string, i uint) Context {
c.l.context = enc.AppendUint(enc.AppendKey(c.l.context, key), i)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Uint",
"(",
"key",
"string",
",",
"i",
"uint",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendUint",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"i",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Uint adds the field key with i as a uint to the logger context. | [
"Uint",
"adds",
"the",
"field",
"key",
"with",
"i",
"as",
"a",
"uint",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L221-L224 |
147,383 | rs/zerolog | context.go | Uint8 | func (c Context) Uint8(key string, i uint8) Context {
c.l.context = enc.AppendUint8(enc.AppendKey(c.l.context, key), i)
return c
} | go | func (c Context) Uint8(key string, i uint8) Context {
c.l.context = enc.AppendUint8(enc.AppendKey(c.l.context, key), i)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Uint8",
"(",
"key",
"string",
",",
"i",
"uint8",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendUint8",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"i",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Uint8 adds the field key with i as a uint8 to the logger context. | [
"Uint8",
"adds",
"the",
"field",
"key",
"with",
"i",
"as",
"a",
"uint8",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L233-L236 |
147,384 | rs/zerolog | context.go | Uint16 | func (c Context) Uint16(key string, i uint16) Context {
c.l.context = enc.AppendUint16(enc.AppendKey(c.l.context, key), i)
return c
} | go | func (c Context) Uint16(key string, i uint16) Context {
c.l.context = enc.AppendUint16(enc.AppendKey(c.l.context, key), i)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Uint16",
"(",
"key",
"string",
",",
"i",
"uint16",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendUint16",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"i",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Uint16 adds the field key with i as a uint16 to the logger context. | [
"Uint16",
"adds",
"the",
"field",
"key",
"with",
"i",
"as",
"a",
"uint16",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L245-L248 |
147,385 | rs/zerolog | context.go | Uint32 | func (c Context) Uint32(key string, i uint32) Context {
c.l.context = enc.AppendUint32(enc.AppendKey(c.l.context, key), i)
return c
} | go | func (c Context) Uint32(key string, i uint32) Context {
c.l.context = enc.AppendUint32(enc.AppendKey(c.l.context, key), i)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Uint32",
"(",
"key",
"string",
",",
"i",
"uint32",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendUint32",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"i",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Uint32 adds the field key with i as a uint32 to the logger context. | [
"Uint32",
"adds",
"the",
"field",
"key",
"with",
"i",
"as",
"a",
"uint32",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L257-L260 |
147,386 | rs/zerolog | context.go | Uint64 | func (c Context) Uint64(key string, i uint64) Context {
c.l.context = enc.AppendUint64(enc.AppendKey(c.l.context, key), i)
return c
} | go | func (c Context) Uint64(key string, i uint64) Context {
c.l.context = enc.AppendUint64(enc.AppendKey(c.l.context, key), i)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Uint64",
"(",
"key",
"string",
",",
"i",
"uint64",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendUint64",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"i",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Uint64 adds the field key with i as a uint64 to the logger context. | [
"Uint64",
"adds",
"the",
"field",
"key",
"with",
"i",
"as",
"a",
"uint64",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L269-L272 |
147,387 | rs/zerolog | context.go | Float32 | func (c Context) Float32(key string, f float32) Context {
c.l.context = enc.AppendFloat32(enc.AppendKey(c.l.context, key), f)
return c
} | go | func (c Context) Float32(key string, f float32) Context {
c.l.context = enc.AppendFloat32(enc.AppendKey(c.l.context, key), f)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Float32",
"(",
"key",
"string",
",",
"f",
"float32",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendFloat32",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"f",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Float32 adds the field key with f as a float32 to the logger context. | [
"Float32",
"adds",
"the",
"field",
"key",
"with",
"f",
"as",
"a",
"float32",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L281-L284 |
147,388 | rs/zerolog | context.go | Float64 | func (c Context) Float64(key string, f float64) Context {
c.l.context = enc.AppendFloat64(enc.AppendKey(c.l.context, key), f)
return c
} | go | func (c Context) Float64(key string, f float64) Context {
c.l.context = enc.AppendFloat64(enc.AppendKey(c.l.context, key), f)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Float64",
"(",
"key",
"string",
",",
"f",
"float64",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendFloat64",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"f",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Float64 adds the field key with f as a float64 to the logger context. | [
"Float64",
"adds",
"the",
"field",
"key",
"with",
"f",
"as",
"a",
"float64",
"to",
"the",
"logger",
"context",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L293-L296 |
147,389 | rs/zerolog | context.go | Dur | func (c Context) Dur(key string, d time.Duration) Context {
c.l.context = enc.AppendDuration(enc.AppendKey(c.l.context, key), d, DurationFieldUnit, DurationFieldInteger)
return c
} | go | func (c Context) Dur(key string, d time.Duration) Context {
c.l.context = enc.AppendDuration(enc.AppendKey(c.l.context, key), d, DurationFieldUnit, DurationFieldInteger)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Dur",
"(",
"key",
"string",
",",
"d",
"time",
".",
"Duration",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendDuration",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"d",
",",
"DurationFieldUnit",
",",
"DurationFieldInteger",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Dur adds the fields key with d divided by unit and stored as a float. | [
"Dur",
"adds",
"the",
"fields",
"key",
"with",
"d",
"divided",
"by",
"unit",
"and",
"stored",
"as",
"a",
"float",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L334-L337 |
147,390 | rs/zerolog | context.go | Durs | func (c Context) Durs(key string, d []time.Duration) Context {
c.l.context = enc.AppendDurations(enc.AppendKey(c.l.context, key), d, DurationFieldUnit, DurationFieldInteger)
return c
} | go | func (c Context) Durs(key string, d []time.Duration) Context {
c.l.context = enc.AppendDurations(enc.AppendKey(c.l.context, key), d, DurationFieldUnit, DurationFieldInteger)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Durs",
"(",
"key",
"string",
",",
"d",
"[",
"]",
"time",
".",
"Duration",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendDurations",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"d",
",",
"DurationFieldUnit",
",",
"DurationFieldInteger",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Durs adds the fields key with d divided by unit and stored as a float. | [
"Durs",
"adds",
"the",
"fields",
"key",
"with",
"d",
"divided",
"by",
"unit",
"and",
"stored",
"as",
"a",
"float",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L340-L343 |
147,391 | rs/zerolog | context.go | Interface | func (c Context) Interface(key string, i interface{}) Context {
c.l.context = enc.AppendInterface(enc.AppendKey(c.l.context, key), i)
return c
} | go | func (c Context) Interface(key string, i interface{}) Context {
c.l.context = enc.AppendInterface(enc.AppendKey(c.l.context, key), i)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"Interface",
"(",
"key",
"string",
",",
"i",
"interface",
"{",
"}",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendInterface",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"i",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // Interface adds the field key with obj marshaled using reflection. | [
"Interface",
"adds",
"the",
"field",
"key",
"with",
"obj",
"marshaled",
"using",
"reflection",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L346-L349 |
147,392 | rs/zerolog | context.go | IPAddr | func (c Context) IPAddr(key string, ip net.IP) Context {
c.l.context = enc.AppendIPAddr(enc.AppendKey(c.l.context, key), ip)
return c
} | go | func (c Context) IPAddr(key string, ip net.IP) Context {
c.l.context = enc.AppendIPAddr(enc.AppendKey(c.l.context, key), ip)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"IPAddr",
"(",
"key",
"string",
",",
"ip",
"net",
".",
"IP",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendIPAddr",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"ip",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // IPAddr adds IPv4 or IPv6 Address to the context | [
"IPAddr",
"adds",
"IPv4",
"or",
"IPv6",
"Address",
"to",
"the",
"context"
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L406-L409 |
147,393 | rs/zerolog | context.go | MACAddr | func (c Context) MACAddr(key string, ha net.HardwareAddr) Context {
c.l.context = enc.AppendMACAddr(enc.AppendKey(c.l.context, key), ha)
return c
} | go | func (c Context) MACAddr(key string, ha net.HardwareAddr) Context {
c.l.context = enc.AppendMACAddr(enc.AppendKey(c.l.context, key), ha)
return c
} | [
"func",
"(",
"c",
"Context",
")",
"MACAddr",
"(",
"key",
"string",
",",
"ha",
"net",
".",
"HardwareAddr",
")",
"Context",
"{",
"c",
".",
"l",
".",
"context",
"=",
"enc",
".",
"AppendMACAddr",
"(",
"enc",
".",
"AppendKey",
"(",
"c",
".",
"l",
".",
"context",
",",
"key",
")",
",",
"ha",
")",
"\n",
"return",
"c",
"\n",
"}"
] | // MACAddr adds MAC address to the context | [
"MACAddr",
"adds",
"MAC",
"address",
"to",
"the",
"context"
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/context.go#L418-L421 |
147,394 | rs/zerolog | globals.go | DisableSampling | func DisableSampling(v bool) {
var i uint32
if v {
i = 1
}
atomic.StoreUint32(disableSampling, i)
} | go | func DisableSampling(v bool) {
var i uint32
if v {
i = 1
}
atomic.StoreUint32(disableSampling, i)
} | [
"func",
"DisableSampling",
"(",
"v",
"bool",
")",
"{",
"var",
"i",
"uint32",
"\n",
"if",
"v",
"{",
"i",
"=",
"1",
"\n",
"}",
"\n",
"atomic",
".",
"StoreUint32",
"(",
"disableSampling",
",",
"i",
")",
"\n",
"}"
] | // DisableSampling will disable sampling in all Loggers if true. | [
"DisableSampling",
"will",
"disable",
"sampling",
"in",
"all",
"Loggers",
"if",
"true",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/globals.go#L100-L106 |
147,395 | rs/zerolog | event.go | RawJSON | func (e *Event) RawJSON(key string, b []byte) *Event {
if e == nil {
return e
}
e.buf = appendJSON(enc.AppendKey(e.buf, key), b)
return e
} | go | func (e *Event) RawJSON(key string, b []byte) *Event {
if e == nil {
return e
}
e.buf = appendJSON(enc.AppendKey(e.buf, key), b)
return e
} | [
"func",
"(",
"e",
"*",
"Event",
")",
"RawJSON",
"(",
"key",
"string",
",",
"b",
"[",
"]",
"byte",
")",
"*",
"Event",
"{",
"if",
"e",
"==",
"nil",
"{",
"return",
"e",
"\n",
"}",
"\n",
"e",
".",
"buf",
"=",
"appendJSON",
"(",
"enc",
".",
"AppendKey",
"(",
"e",
".",
"buf",
",",
"key",
")",
",",
"b",
")",
"\n",
"return",
"e",
"\n",
"}"
] | // RawJSON adds already encoded JSON to the log line under key.
//
// No sanity check is performed on b; it must not contain carriage returns and
// be valid JSON. | [
"RawJSON",
"adds",
"already",
"encoded",
"JSON",
"to",
"the",
"log",
"line",
"under",
"key",
".",
"No",
"sanity",
"check",
"is",
"performed",
"on",
"b",
";",
"it",
"must",
"not",
"contain",
"carriage",
"returns",
"and",
"be",
"valid",
"JSON",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/event.go#L258-L264 |
147,396 | rs/zerolog | event.go | Dur | func (e *Event) Dur(key string, d time.Duration) *Event {
if e == nil {
return e
}
e.buf = enc.AppendDuration(enc.AppendKey(e.buf, key), d, DurationFieldUnit, DurationFieldInteger)
return e
} | go | func (e *Event) Dur(key string, d time.Duration) *Event {
if e == nil {
return e
}
e.buf = enc.AppendDuration(enc.AppendKey(e.buf, key), d, DurationFieldUnit, DurationFieldInteger)
return e
} | [
"func",
"(",
"e",
"*",
"Event",
")",
"Dur",
"(",
"key",
"string",
",",
"d",
"time",
".",
"Duration",
")",
"*",
"Event",
"{",
"if",
"e",
"==",
"nil",
"{",
"return",
"e",
"\n",
"}",
"\n",
"e",
".",
"buf",
"=",
"enc",
".",
"AppendDuration",
"(",
"enc",
".",
"AppendKey",
"(",
"e",
".",
"buf",
",",
"key",
")",
",",
"d",
",",
"DurationFieldUnit",
",",
"DurationFieldInteger",
")",
"\n",
"return",
"e",
"\n",
"}"
] | // Dur adds the field key with duration d stored as zerolog.DurationFieldUnit.
// If zerolog.DurationFieldInteger is true, durations are rendered as integer
// instead of float. | [
"Dur",
"adds",
"the",
"field",
"key",
"with",
"duration",
"d",
"stored",
"as",
"zerolog",
".",
"DurationFieldUnit",
".",
"If",
"zerolog",
".",
"DurationFieldInteger",
"is",
"true",
"durations",
"are",
"rendered",
"as",
"integer",
"instead",
"of",
"float",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/event.go#L616-L622 |
147,397 | rs/zerolog | event.go | Durs | func (e *Event) Durs(key string, d []time.Duration) *Event {
if e == nil {
return e
}
e.buf = enc.AppendDurations(enc.AppendKey(e.buf, key), d, DurationFieldUnit, DurationFieldInteger)
return e
} | go | func (e *Event) Durs(key string, d []time.Duration) *Event {
if e == nil {
return e
}
e.buf = enc.AppendDurations(enc.AppendKey(e.buf, key), d, DurationFieldUnit, DurationFieldInteger)
return e
} | [
"func",
"(",
"e",
"*",
"Event",
")",
"Durs",
"(",
"key",
"string",
",",
"d",
"[",
"]",
"time",
".",
"Duration",
")",
"*",
"Event",
"{",
"if",
"e",
"==",
"nil",
"{",
"return",
"e",
"\n",
"}",
"\n",
"e",
".",
"buf",
"=",
"enc",
".",
"AppendDurations",
"(",
"enc",
".",
"AppendKey",
"(",
"e",
".",
"buf",
",",
"key",
")",
",",
"d",
",",
"DurationFieldUnit",
",",
"DurationFieldInteger",
")",
"\n",
"return",
"e",
"\n",
"}"
] | // Durs adds the field key with duration d stored as zerolog.DurationFieldUnit.
// If zerolog.DurationFieldInteger is true, durations are rendered as integer
// instead of float. | [
"Durs",
"adds",
"the",
"field",
"key",
"with",
"duration",
"d",
"stored",
"as",
"zerolog",
".",
"DurationFieldUnit",
".",
"If",
"zerolog",
".",
"DurationFieldInteger",
"is",
"true",
"durations",
"are",
"rendered",
"as",
"integer",
"instead",
"of",
"float",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/event.go#L627-L633 |
147,398 | rs/zerolog | event.go | Interface | func (e *Event) Interface(key string, i interface{}) *Event {
if e == nil {
return e
}
if obj, ok := i.(LogObjectMarshaler); ok {
return e.Object(key, obj)
}
e.buf = enc.AppendInterface(enc.AppendKey(e.buf, key), i)
return e
} | go | func (e *Event) Interface(key string, i interface{}) *Event {
if e == nil {
return e
}
if obj, ok := i.(LogObjectMarshaler); ok {
return e.Object(key, obj)
}
e.buf = enc.AppendInterface(enc.AppendKey(e.buf, key), i)
return e
} | [
"func",
"(",
"e",
"*",
"Event",
")",
"Interface",
"(",
"key",
"string",
",",
"i",
"interface",
"{",
"}",
")",
"*",
"Event",
"{",
"if",
"e",
"==",
"nil",
"{",
"return",
"e",
"\n",
"}",
"\n",
"if",
"obj",
",",
"ok",
":=",
"i",
".",
"(",
"LogObjectMarshaler",
")",
";",
"ok",
"{",
"return",
"e",
".",
"Object",
"(",
"key",
",",
"obj",
")",
"\n",
"}",
"\n",
"e",
".",
"buf",
"=",
"enc",
".",
"AppendInterface",
"(",
"enc",
".",
"AppendKey",
"(",
"e",
".",
"buf",
",",
"key",
")",
",",
"i",
")",
"\n",
"return",
"e",
"\n",
"}"
] | // Interface adds the field key with i marshaled using reflection. | [
"Interface",
"adds",
"the",
"field",
"key",
"with",
"i",
"marshaled",
"using",
"reflection",
"."
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/event.go#L651-L660 |
147,399 | rs/zerolog | event.go | IPAddr | func (e *Event) IPAddr(key string, ip net.IP) *Event {
if e == nil {
return e
}
e.buf = enc.AppendIPAddr(enc.AppendKey(e.buf, key), ip)
return e
} | go | func (e *Event) IPAddr(key string, ip net.IP) *Event {
if e == nil {
return e
}
e.buf = enc.AppendIPAddr(enc.AppendKey(e.buf, key), ip)
return e
} | [
"func",
"(",
"e",
"*",
"Event",
")",
"IPAddr",
"(",
"key",
"string",
",",
"ip",
"net",
".",
"IP",
")",
"*",
"Event",
"{",
"if",
"e",
"==",
"nil",
"{",
"return",
"e",
"\n",
"}",
"\n",
"e",
".",
"buf",
"=",
"enc",
".",
"AppendIPAddr",
"(",
"enc",
".",
"AppendKey",
"(",
"e",
".",
"buf",
",",
"key",
")",
",",
"ip",
")",
"\n",
"return",
"e",
"\n",
"}"
] | // IPAddr adds IPv4 or IPv6 Address to the event | [
"IPAddr",
"adds",
"IPv4",
"or",
"IPv6",
"Address",
"to",
"the",
"event"
] | acf3980132bfcdc48638724e6e3d9e5749b85999 | https://github.com/rs/zerolog/blob/acf3980132bfcdc48638724e6e3d9e5749b85999/event.go#L680-L686 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.