Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONLogger ¶
type JSONLogger struct {
// contains filtered or unexported fields
}
func NewJSONLogger ¶
func NewJSONLogger(w io.Writer) *JSONLogger
NewJSONLogger creates a new JSONLogger which generates valid JSON ouputs and includes the same unique id in each log line generated through this logger.
func (*JSONLogger) Write ¶
func (j *JSONLogger) Write(p []byte) (int, error)
Write implements the io.Writer interface. The input is expected to be log lines separated by newlines. If the log line is already valid JSON, the logger simply adds the id field. If the log line is not valid JSON, then the log line is wrapped in a JSON.
type PrefixWriter ¶
type PrefixWriter struct {
// contains filtered or unexported fields
}
PrefixWriter wraps an io.Writer to automatically add a prefix at the beginning of every line.
func NewPrefixWriter ¶
func NewPrefixWriter(w io.Writer) *PrefixWriter
NewPrefixWriter creates a PrefixWriter.
func (*PrefixWriter) SetPrefix ¶
func (w *PrefixWriter) SetPrefix(prefix []byte)
SetPrefix sets the prefix.
Click to show internal directories.
Click to hide internal directories.