# README
Package: github.com/strongo/logus
Package strongo/logus provides structured context aware logging for Go (golang) that supports grouping of log entries using trace and span IDs.
Usage
package foo
import "context"
import "github.com/strongo/logus"
func init() {
logus.AddLogEntryHandler(logus.StandardGoLogger())
Bar(context.Background())
}
// Bar demonstrates how to use logus logger
func Bar(c context.Context) {
logus.Debugf(c, "This is a debug message without trace ID, unless it was set outside")
const traceID = "123"
ct := logus.WithTraceID(c, traceID)
logus.Infof(ct, "This is an info message with a traceID=%s", traceID)
const spanID = "456"
ct = logus.WithSpanID(ct, spanID)
logus.Warningf(ct, "A warning with same trace ID and additional spanID=%s", spanID)
logus.Logf(c, logus.SeverityError, "This is an error log message without trace ID")
}
Logus log entry handlers
- logus/go_logger.go - log entries to STDOUT & STDERR.
- github.com/strongo/loguscloud - send log entries to Google Cloud Logging. Support grouping of log entries by request (using trace & span ID).
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GetLabels returns labels from context.
No description provided by the author
No description provided by the author
GetSpanID returns span ID from context.
GetTraceID returns trace ID from context.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
WithLabels adds labels to context.
WithSpanID adds span ID to context.
WithTraceID adds trace ID to context.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Interfaces
LogEntryHandler should implement persistence of logs entries.
Logger defines logs dispatcher.
No description provided by the author
# Type aliases
No description provided by the author