Documentation ¶
Index ¶
- Constants
- Variables
- func Context(ctx context.Context, e Event) context.Context
- type Console
- type Event
- func (e Event) AddLabel(key, value string) Event
- func (e Event) Alert() Event
- func (e Event) Critical() Event
- func (e Event) Debug() Event
- func (e Event) Emergency() Event
- func (e Event) Error() Event
- func (e Event) Fmt(format string, args ...interface{})
- func (e Event) Info() Event
- func (e Event) Msg(message string)
- func (e Event) Notice() Event
- func (e Event) SetData(data interface{}) Event
- func (e Event) SetError(err error) Event
- func (e Event) SetExporter(exporter Exporter) Event
- func (e Event) SetFilter(filter Filter) Event
- func (e Event) SetFormatter(formatter Formatter) Event
- func (e Event) SetHTTPRequest(req *http.Request) Event
- func (e Event) SetMinLogLevel(minLevel Level) Event
- func (e Event) SetServiceName(name string) Event
- func (e Event) SetServiceVersion(version string) Event
- func (e Event) SetSpanID(spanID trace.SpanID) Event
- func (e Event) SetTraceID(traceID trace.ID) Event
- func (e Event) Warning() Event
- type Exporter
- type Filter
- type Formatter
- type Level
- type NoFilter
- type Stackdriver
- type StdoutExporter
Constants ¶
View Source
const Key key = 0
Key references an existing log event inside a context.
Variables ¶
View Source
var ( // DefaultEvent returns a default log event. DefaultEvent = New(&NoFilter{}, &Console{}, &StdoutExporter{}, Debug) )
Functions ¶
Types ¶
type Console ¶
type Console struct { }
Console formats an event into a colour formatted human readable text.
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
func NewWithTrace ¶
NewWithTrace creates a new default log event with initialised trace IDs.
func (Event) SetExporter ¶
func (Event) SetFormatter ¶
func (Event) SetMinLogLevel ¶
func (Event) SetServiceName ¶
func (Event) SetServiceVersion ¶
type Exporter ¶
type Exporter interface {
Export(string)
}
Exporter emits log messages to an output source.
type Level ¶
type Level int
Level denotes the importance of a log event.
const ( // Default means that the log event has no assigned log level. Default Level = iota * 100 // Debug or trace information. Debug // Info events are routine information, such as ongoing status or performance. Info // Notice are normal but significant events, such as start up, shut down, or a configuration change. Notice // Warning events might cause problems. Warning // Error events are likely to cause problems. Error // Critical events cause more severe problems or outages. Critical // Alert events mean that a person must take an action immediately. Alert // Emergency means that one or more systems are unusable. Emergency )
func ParseLevel ¶
ParseLevel parses a string value into a log level.
type Stackdriver ¶
type Stackdriver struct { }
Stackdriver formats an event into the Stackdriver specific JSON format.
func (*Stackdriver) Format ¶
func (f *Stackdriver) Format(e Event) string
Format formats a log event into the Stackdriver specific JSON schema.
type StdoutExporter ¶
type StdoutExporter struct{}
StdoutExporter emits log events to stdout.
func (*StdoutExporter) Export ¶
func (e *StdoutExporter) Export(output string)
Export writes the output directly to stdout.
Click to show internal directories.
Click to hide internal directories.