Documentation ¶
Overview ¶
Package protolion defines the Protocol Buffers functionality for lion.
Index ¶
- Variables
- func Debug(event proto.Message)
- func DebugWriter() io.Writer
- func Debugf(format string, args ...interface{})
- func Debugln(args ...interface{})
- func Error(event proto.Message)
- func ErrorWriter() io.Writer
- func Errorf(format string, args ...interface{})
- func Errorln(args ...interface{})
- func Fatal(event proto.Message)
- func Fatalf(format string, args ...interface{})
- func Fatalln(args ...interface{})
- func Flush() error
- func Info(event proto.Message)
- func InfoWriter() io.Writer
- func Infof(format string, args ...interface{})
- func Infoln(args ...interface{})
- func LionLogger() lion.Logger
- func Panic(event proto.Message)
- func Panicf(format string, args ...interface{})
- func Panicln(args ...interface{})
- func Print(event proto.Message)
- func Printf(format string, args ...interface{})
- func Println(args ...interface{})
- func Warn(event proto.Message)
- func WarnWriter() io.Writer
- func Warnf(format string, args ...interface{})
- func Warnln(args ...interface{})
- func Writer() io.Writer
- type Entry
- func (*Entry) Descriptor() ([]byte, []int)
- func (m *Entry) GetContext() []*Entry_Message
- func (m *Entry) GetEvent() *Entry_Message
- func (m *Entry) GetFields() map[string]string
- func (m *Entry) GetId() string
- func (m *Entry) GetLevel() Level
- func (m *Entry) GetMessage() string
- func (m *Entry) GetTimestamp() *Timestamp
- func (m *Entry) GetWriterOutput() []byte
- func (*Entry) ProtoMessage()
- func (m *Entry) Reset()
- func (m *Entry) String() string
- type Entry_Message
- type Level
- type LevelLogger
- type Logger
- func AtLevel(level lion.Level) Logger
- func GlobalLogger() Logger
- func NewLogger(delegate lion.Logger) Logger
- func WithContext(context proto.Message) Logger
- func WithField(key string, value interface{}) Logger
- func WithFields(fields map[string]interface{}) Logger
- func WithKeyValues(keyValues ...interface{}) Logger
- type Timestamp
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Encoding is the name of the encoding. Encoding = "proto" // DelimitedMarshaller is a Marshaller that uses the protocol buffers write delimited scheme. DelimitedMarshaller = newDelimitedMarshaller(false, false) // DelimitedUnmarshaller is an Unmarshaller that uses the protocol buffers write delimited scheme. DelimitedUnmarshaller = newDelimitedUnmarshaller(false, false) // Base64DelimitedMarshaller is a Marshaller that uses the protocol buffers write delimited scheme, // but encodes the encoded protocol buffer message using base64.StdEncoding. Base64DelimitedMarshaller = newDelimitedMarshaller(true, false) // Base64DelimitedUnmarshaller is an Unmarshaller that uses the protocol buffers write delimited scheme, // but decoded the encoded protocol buffer message using base64.StdEncoding. Base64DelimitedUnmarshaller = newDelimitedUnmarshaller(true, false) // Base64DelimitedNewlineMarshaller is a Marshaller that uses the protocol buffers write delimited scheme, // but encodes the encoded protocol buffer message using base64.StdEncoding, and a newline is added. Base64DelimitedNewlineMarshaller = newDelimitedMarshaller(true, true) // Base64DelimitedNewlineUnmarshaller is an Unmarshaller that uses the protocol buffers write delimited scheme, // but decoded the encoded protocol buffer message using base64.StdEncoding, and a newline is read at the end. Base64DelimitedNewlineUnmarshaller = newDelimitedUnmarshaller(true, true) // DefaultJSONMarshalFunc is the default protocol buffers JSONMarshalFunc. DefaultJSONMarshalFunc = func(writer io.Writer, data interface{}) error { if message, ok := data.(proto.Message); ok { return globalJSONMarshaler.Marshal(writer, message) } return lion.DefaultJSONMarshalFunc(writer, data) } )
Functions ¶
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf calls Debugf on the global Logger.
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf calls Errorf on the global Logger.
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf calls Fatalf on the global Logger.
func Panicf ¶
func Panicf(format string, args ...interface{})
Panicf calls Panicf on the global Logger.
Types ¶
type Entry ¶
type Entry struct { // id may not be set depending on logger options // it is up to the user to determine if id is required Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` Level Level `protobuf:"varint,2,opt,name=level,enum=lion.Level" json:"level,omitempty"` Timestamp *Timestamp `protobuf:"bytes,3,opt,name=timestamp" json:"timestamp,omitempty"` // both context and fields may be set Context []*Entry_Message `protobuf:"bytes,4,rep,name=context" json:"context,omitempty"` Fields map[string]string `` /* 132-byte string literal not displayed */ // one of event, message, writer_output will be set Event *Entry_Message `protobuf:"bytes,6,opt,name=event" json:"event,omitempty"` Message string `protobuf:"bytes,7,opt,name=message" json:"message,omitempty"` WriterOutput []byte `protobuf:"bytes,8,opt,name=writer_output,json=writerOutput,proto3" json:"writer_output,omitempty"` }
Entry is the object serialized for logging.
func (*Entry) GetContext ¶
func (m *Entry) GetContext() []*Entry_Message
func (*Entry) GetEvent ¶
func (m *Entry) GetEvent() *Entry_Message
type Entry_Message ¶
type Entry_Message struct { Encoding string `protobuf:"bytes,1,opt,name=encoding" json:"encoding,omitempty"` Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` }
Message represents a serialized protobuf message. The name is the name registered with lion.
func (*Entry_Message) Descriptor ¶
func (*Entry_Message) Descriptor() ([]byte, []int)
func (*Entry_Message) GetEncoding ¶
func (m *Entry_Message) GetEncoding() string
func (*Entry_Message) GetName ¶
func (m *Entry_Message) GetName() string
func (*Entry_Message) GetValue ¶
func (m *Entry_Message) GetValue() []byte
func (*Entry_Message) ProtoMessage ¶
func (*Entry_Message) ProtoMessage()
func (*Entry_Message) Reset ¶
func (m *Entry_Message) Reset()
func (*Entry_Message) String ¶
func (m *Entry_Message) String() string
type LevelLogger ¶
type LevelLogger interface { lion.BaseLevelLogger WithField(key string, value interface{}) LevelLogger WithFields(fields map[string]interface{}) LevelLogger WithKeyValues(keyvalues ...interface{}) LevelLogger WithContext(context proto.Message) LevelLogger Print(event proto.Message) }
LevelLogger is a lion.LevelLogger that also has proto logging methods.
type Logger ¶
type Logger interface { lion.BaseLogger AtLevel(level lion.Level) Logger WithField(key string, value interface{}) Logger WithFields(fields map[string]interface{}) Logger WithKeyValues(keyValues ...interface{}) Logger WithContext(context proto.Message) Logger Debug(event proto.Message) Info(event proto.Message) Warn(event proto.Message) Error(event proto.Message) Fatal(event proto.Message) Panic(event proto.Message) Print(event proto.Message) // NOTE: this function name may change, this is experimental LogDebug() LevelLogger // NOTE: this function name may change, this is experimental LogInfo() LevelLogger LionLogger() lion.Logger }
Logger is a lion.Logger that also has proto logging methods.
func WithContext ¶
WithContext calls WithContext on the global Logger.
func WithField ¶
WithField calls WithField on the global Logger.
func WithFields ¶
WithFields calls WithFields on the global Logger.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.