mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-24 09:20:31 +00:00
4df9c8d6a5
* github.com/russross/meddler v1.0.0 -> v1.0.1 * github.com/gin-gonic/gin v1.6.3 -> v1.7.4 * github.com/go-sql-driver/mysql v1.5.0 -> v1.6.0 * github.com/sirupsen/logrus v1.6.0 -> v1.8.1 * github.com/rs/zerolog v1.18.0 -> v1.25.0
42 lines
941 B
Go
42 lines
941 B
Go
// +build binary_log
|
|
|
|
package zerolog
|
|
|
|
// This file contains bindings to do binary encoding.
|
|
|
|
import (
|
|
"github.com/rs/zerolog/internal/cbor"
|
|
)
|
|
|
|
var (
|
|
_ encoder = (*cbor.Encoder)(nil)
|
|
|
|
enc = cbor.Encoder{}
|
|
)
|
|
|
|
func init() {
|
|
// using closure to reflect the changes at runtime.
|
|
cbor.JSONMarshalFunc = func(v interface{}) ([]byte, error) {
|
|
return InterfaceMarshalFunc(v)
|
|
}
|
|
}
|
|
|
|
func appendJSON(dst []byte, j []byte) []byte {
|
|
return cbor.AppendEmbeddedJSON(dst, j)
|
|
}
|
|
|
|
// decodeIfBinaryToString - converts a binary formatted log msg to a
|
|
// JSON formatted String Log message.
|
|
func decodeIfBinaryToString(in []byte) string {
|
|
return cbor.DecodeIfBinaryToString(in)
|
|
}
|
|
|
|
func decodeObjectToStr(in []byte) string {
|
|
return cbor.DecodeObjectToStr(in)
|
|
}
|
|
|
|
// decodeIfBinaryToBytes - converts a binary formatted log msg to a
|
|
// JSON formatted Bytes Log message.
|
|
func decodeIfBinaryToBytes(in []byte) []byte {
|
|
return cbor.DecodeIfBinaryToBytes(in)
|
|
}
|