blob: f8d3fe9e73bcb317e9599502e9936c840b413c0a [file] [log] [blame]
khenaidooac637102019-01-14 15:44:34 -05001// +build binary_log
2
3package zerolog
4
5// This file contains bindings to do binary encoding.
6
7import (
8 "github.com/rs/zerolog/internal/cbor"
9)
10
11var (
12 _ encoder = (*cbor.Encoder)(nil)
13
14 enc = cbor.Encoder{}
15)
16
17func appendJSON(dst []byte, j []byte) []byte {
18 return cbor.AppendEmbeddedJSON(dst, j)
19}
20
21// decodeIfBinaryToString - converts a binary formatted log msg to a
22// JSON formatted String Log message.
23func decodeIfBinaryToString(in []byte) string {
24 return cbor.DecodeIfBinaryToString(in)
25}
26
27func decodeObjectToStr(in []byte) string {
28 return cbor.DecodeObjectToStr(in)
29}
30
31// decodeIfBinaryToBytes - converts a binary formatted log msg to a
32// JSON formatted Bytes Log message.
33func decodeIfBinaryToBytes(in []byte) []byte {
34 return cbor.DecodeIfBinaryToBytes(in)
35}