Documentation ¶
Overview ¶
Package kvlog provides a key-value based logging system primary targetting container based deployments.
Example ¶
Debug(KV("event", "test"), KV("foo", "bar")) Info(KV("event", "test"), KV("foo", "bar"))
Output:
Index ¶
- Constants
- func ConfigureOutput(out Output)
- func ConfigureThreshold(t Level)
- func Debug(pairs ...KVPair)
- func Error(pairs ...KVPair)
- func Handler(l *Logger, h http.Handler) http.Handler
- func Info(pairs ...KVPair)
- func Warn(pairs ...KVPair)
- type KVPair
- type Level
- type Logger
- type Message
- type Output
- type WriterLogOutput
Examples ¶
Constants ¶
View Source
const ( KeyLevel = "level" KeyTimestamp = "ts" )
Variables ¶
This section is empty.
Functions ¶
func ConfigureOutput ¶
func ConfigureOutput(out Output)
func ConfigureThreshold ¶
func ConfigureThreshold(t Level)
Types ¶
type KVPair ¶
type KVPair struct { // Key stores the key of the pair Key string // Value stores the value Value interface{} }
KVPair implements a key-value pair
type Logger ¶
type Logger struct { Threshold Level // contains filtered or unexported fields }
Logger implements a logger component. The output is written to the given output.
var L *Logger
type Message ¶
type Message []KVPair
Message represents a single log message expressed as an ordered list of key value pairs
func NewMessage ¶
NewMessage creates a new message from the given log level and key-value pairs
type Output ¶
type Output interface {
WriteLogMessage(m Message)
}
Output describes the interface to be implemented by log output streams
type WriterLogOutput ¶
type WriterLogOutput struct {
// contains filtered or unexported fields
}
WriterLogOutput implements a Output that writes to an io.Writer
func (*WriterLogOutput) WriteLogMessage ¶
func (w *WriterLogOutput) WriteLogMessage(m Message)
WriteLogMessage writes the bytes to the writer
Click to show internal directories.
Click to hide internal directories.