Field instances are constructed via LogBool, LogString, and so on.
Tracing implementations may then handle them via the Field.Marshal
method.
"heavily influenced by" (i.e., partially stolen from)
https://github.com/uber-go/zap Key returns the field's key. Marshal passes a Field instance through to the appropriate
field-type-specific method of an Encoder. String returns a string representation of the key and value. Value returns the field's value as interface{}.
Field : github.com/ChrisTrenkamp/goxpath/tree.Result
Field : fmt.Stringer
func Bool(key string, val bool) Field
func Error(err error) Field
func Event(val string) Field
func Float32(key string, val float32) Field
func Float64(key string, val float64) Field
func Int(key string, val int) Field
func Int32(key string, val int32) Field
func Int64(key string, val int64) Field
func InterleavedKVToFields(keyValues ...interface{}) ([]Field, error)
func Lazy(ll LazyLogger) Field
func Message(val string) Field
func Noop() Field
func Object(key string, obj interface{}) Field
func String(key, val string) Field
func Uint32(key string, val uint32) Field
func Uint64(key string, val uint64) Field
func github.com/opentracing/opentracing-go.Span.LogFields(fields ...Field)
LazyLogger allows for user-defined, late-bound logging of arbitrary data
func Lazy(ll LazyLogger) Field
func Encoder.EmitLazyLogger(value LazyLogger)
Package-Level Functions (total 16)
Bool adds a bool-valued key:value pair to a Span.LogFields() record
Error adds an error with the key "error.object" to a Span.LogFields() record
Event creates a string-valued Field for span logs with key="event" and value=val.
Float32 adds a float32-valued key:value pair to a Span.LogFields() record
Float64 adds a float64-valued key:value pair to a Span.LogFields() record
Int adds an int-valued key:value pair to a Span.LogFields() record
Int32 adds an int32-valued key:value pair to a Span.LogFields() record
Int64 adds an int64-valued key:value pair to a Span.LogFields() record
InterleavedKVToFields converts keyValues a la Span.LogKV() to a Field slice
a la Span.LogFields().
Lazy adds a LazyLogger to a Span.LogFields() record; the tracing
implementation will call the LazyLogger function at an indefinite time in
the future (after Lazy() returns).
Message creates a string-valued Field for span logs with key="message" and value=val.
Noop creates a no-op log field that should be ignored by the tracer.
It can be used to capture optional fields, for example those that should
only be logged in non-production environment:
func customerField(order *Order) log.Field {
if os.Getenv("ENVIRONMENT") == "dev" {
return log.String("customer", order.Customer.ID)
}
return log.Noop()
}
span.LogFields(log.String("event", "purchase"), customerField(order))
Object adds an object-valued key:value pair to a Span.LogFields() record
Please pass in an immutable object, otherwise there may be concurrency issues.
Such as passing in the map, log.Object may result in "fatal error: concurrent map iteration and map write".
Because span is sent asynchronously, it is possible that this map will also be modified.
String adds a string-valued key:value pair to a Span.LogFields() record
Uint32 adds a uint32-valued key:value pair to a Span.LogFields() record
Uint64 adds a uint64-valued key:value pair to a Span.LogFields() record
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.