Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedKeyType = errors.New("unsupported key type")
ErrUnsupportedKeyType is returned by Encoder methods if a key has an unsupported type.
var ErrUnsupportedValueType = errors.New("unsupported value type")
ErrUnsupportedValueType is returned by Encoder methods if a value has an unsupported type.
Functions ¶
func MarshalKeyvals ¶
MarshalKeyvals returns the clilog encoding of keyvals, a variadic sequence of alternating keys and values.
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
An Encoder writes clilog data to an output stream.
func NewEncoder ¶
NewEncoder returns a new clilog Encoder that writes to w.
func (*Encoder) EncodeKeyval ¶
EncodeKeyval writes the clilog encoding of key and value to the stream. A single space is written before the second and subsequent keys in a record. Nothing is written if a non-nil error is returned.
func (*Encoder) EncodeKeyvals ¶
EncodeKeyvals writes the logfmt encoding of keyvals to the stream. Keyvals is a variadic sequence of alternating keys and values. Keys of unsupported type are skipped along with their corresponding value. Values of unsupported type or that cause a MarshalerError are replaced by their error but do not cause EncodeKeyvals to return an error. If a non-nil error is returned some key/value pairs may not have be written.
type Logger ¶
type Logger interface {
Log(keyvals ...interface{}) error
}
Logger interface compatible with go-kit/logger.
type MarshalerError ¶
MarshalerError represents an error encountered while marshaling a value.
func (*MarshalerError) Error ¶
func (e *MarshalerError) Error() string