Documentation ¶
Overview ¶
Package gocutelog makes it possible to send log records from Go logging libraries to a cutelog instance without having to manually manage a socket connection.
Function NewWriter returns a struct that implements io.Writer interface so it can be used as output by libraries like zerolog, zap, onelog, logrus, etc.
Just like cutelog itself, this package is meant to be used only during development, so performance or reliability are not the focus here.
Example usage with zerolog:
w := gocutelog.NewWriter("localhost:19996", "json") l := zerolog.New(w) l.Info().Msg("Hello world from zerolog!")
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogWriter ¶
LogWriter manages the socket connection to cutelog. It implements io.Writer interface, as well as zapcore.WriteSyncer and zap.Sink.
func NewWriter ¶
NewWriter creates a prepared LogWriter that is ready to be used. If it can connect within the first 100 milliseconds then no records will be dropped in the beginning.
Argument addr specifies the address of the cutelog instance (e.g. "localhost:19996"), and format specifies serialization format that will be signaled (e.g. json, msgpack, cbor).