Documentation
¶
Index ¶
- Constants
- func AtomicLevel() zap.AtomicLevel
- func Attribute(attr attribute.KeyValue) zap.Field
- func AttributeKey(key attribute.Key) string
- func Attributes(attrs ...attribute.KeyValue) []zap.Field
- func FCodeInstance(v string) zap.Fielddeprecated
- func FCodeLine(v int) zap.Fielddeprecated
- func FCodeMethod(v string) zap.Fielddeprecated
- func FCodePackage(v string) zap.Fielddeprecated
- func FDuration(duration time.Duration) zap.Field
- func FDurationFn() func() zap.Field
- func FDurationHour(duration time.Duration) zap.Field
- func FDurationMin(duration time.Duration) zap.Field
- func FDurationSec(duration time.Duration) zap.Field
- func FError(err error) zap.Field
- func FErrorType(err error) zap.Field
- func FHTTPClientIP(clientIP string) zap.Fielddeprecated
- func FHTTPFlavor(flavor string) zap.Fielddeprecated
- func FHTTPHost(host string) zap.Fielddeprecated
- func FHTTPMethod(name string) zap.Fielddeprecated
- func FHTTPReferer(host string) zap.Fielddeprecated
- func FHTTPRequestContentLength(bytes int64) zap.Fielddeprecated
- func FHTTPRequestID(id string) zap.Fielddeprecated
- func FHTTPScheme(scheme string) zap.Fielddeprecated
- func FHTTPServerName(id string) zap.Fielddeprecated
- func FHTTPSessionID(id string) zap.Fielddeprecated
- func FHTTPStatusCode(status int) zap.Fielddeprecated
- func FHTTPTarget(target string) zap.Fielddeprecated
- func FHTTPTrackingID(id string) zap.Fielddeprecated
- func FHTTPUserAgent(userAgent string) zap.Fielddeprecated
- func FHTTPWroteBytes(bytes int64) zap.Fielddeprecated
- func FJSON(v any) zap.Field
- func FMessagingConversationID(value string) zap.Fielddeprecated
- func FMessagingDestination(value string) zap.Fielddeprecated
- func FMessagingDestinationKind(value MessagingDestinationKind) zap.Fielddeprecated
- func FMessagingMessageID(value string) zap.Fielddeprecated
- func FMessagingMessagePayloadCompressedSizeBytes(value string) zap.Fielddeprecated
- func FMessagingMessagePayloadSizeBytes(value string) zap.Fielddeprecated
- func FMessagingProtocol(value string) zap.Fielddeprecated
- func FMessagingProtocolVersion(value string) zap.Fielddeprecated
- func FMessagingSystem(value string) zap.Fielddeprecated
- func FMessagingURL(value string) zap.Fielddeprecated
- func FName(name string) zap.Field
- func FNetHostIP(ip string) zap.Fielddeprecated
- func FNetHostPort(port string) zap.Fielddeprecated
- func FNum(num int) zap.Field
- func FPeerService(name string) zap.Fielddeprecated
- func FServiceInstanceID(id string) zap.Fielddeprecated
- func FServiceMethod(method string) zap.Fielddeprecated
- func FServiceName(name string) zap.Fielddeprecated
- func FServiceNamespace(namespace string) zap.Fielddeprecated
- func FServiceType(name string) zap.Fielddeprecated
- func FServiceVersion(version string) zap.Fielddeprecated
- func FSpanID(traceID string) zap.Field
- func FStackSkip(skip int) zap.Field
- func FStreamQueue(queue string) zap.Fielddeprecated
- func FStreamSubject(name string) zap.Fielddeprecated
- func FTraceID(traceID string) zap.Field
- func FValue(value any) zap.Field
- func IsDisableCaller() bool
- func IsDisableStacktrace() bool
- func Logger() *zap.Logger
- func Must(l *zap.Logger, err error, msgAndArgs ...any)
- func NewLogger(level, encoding string) *zap.Logger
- func SetDisableCaller(value bool) error
- func SetDisableStacktrace(value bool) error
- func With(l *zap.Logger, fields ...zap.Field) *zap.Logger
- func WithAttributes(l *zap.Logger, attrs ...attribute.KeyValue) *zap.Logger
- func WithError(l *zap.Logger, err error) *zap.Logger
- func WithHTTPClientIP(l *zap.Logger, r *http.Request) *zap.Logger
- func WithHTTPFlavor(l *zap.Logger, r *http.Request) *zap.Logger
- func WithHTTPHost(l *zap.Logger, r *http.Request) *zap.Logger
- func WithHTTPReferer(l *zap.Logger, r *http.Request) *zap.Logger
- func WithHTTPRequest(l *zap.Logger, r *http.Request) *zap.Logger
- func WithHTTPRequestID(l *zap.Logger, r *http.Request) *zap.Logger
- func WithHTTPRequestOut(l *zap.Logger, r *http.Request) *zap.Logger
- func WithHTTPScheme(l *zap.Logger, r *http.Request) *zap.Logger
- func WithHTTPServerName(l *zap.Logger, name string) *zap.Logger
- func WithHTTPSessionID(l *zap.Logger, r *http.Request) *zap.Logger
- func WithHTTPTrackingID(l *zap.Logger, r *http.Request) *zap.Logger
- func WithServiceName(l *zap.Logger, name string) *zap.Logger
- func WithTraceID(l *zap.Logger, ctx context.Context) *zap.Logger
- type Config
- type Labeler
- type LabelerContextKey
- type MessagingDestinationKinddeprecated
Constants ¶
const ( // NumKey - generic number attribute NumKey = "num" // NameKey - generic name attribute NameKey = "name" // ValueKey - generic value attribute ValueKey = "value" // JSONKey - generic json attribute JSONKey = "json" )
const ( // Deprecated: use semconv messaging attributes instead. CodeInstanceKey = "code_instance" // Deprecated: use semconv messaging attributes instead. CodePackageKey = "code_package" // Deprecated: use semconv messaging attributes instead. CodeMethodKey = "code_method" // Deprecated: use semconv messaging attributes instead. CodeLineKey = "code_line" )
const ( // DurationKey - generic duration attribute DurationKey = "duration" // DurationSecKey - duration in seconds DurationSecKey = "duration_sec" // DurationMinKey - duration in minutes DurationMinKey = "duration_min" // DurationHourKey - duration in hours DurationHourKey = "duration_hour" )
const ( ErrorTypeKey = "error_type" ErrorMessageKey = "error_message" ErrorStacktraceKey = "error_stacktrace" )
const ( // Deprecated: use semconv messaging attributes instead. HTTPServerNameKey = "http_server_name" // Deprecated: use semconv messaging attributes instead. HTTPMethodKey = "http_method" // Deprecated: use semconv messaging attributes instead. HTTPTargetKey = "http_target" // Deprecated: use semconv messaging attributes instead. HTTPHostKey = "http_host" // Deprecated: use semconv messaging attributes instead. HTTPStatusCodeKey = "http_status_code" // Deprecated: use semconv messaging attributes instead. HTTPUserAgentKey = "http_user_agent" // Deprecated: use semconv messaging attributes instead. HTTPClientIPKey = "http_client_ip" // Deprecated: use semconv messaging attributes instead. HTTPRequestContentLengthKey = "http_read_bytes" // Deprecated: use semconv messaging attributes instead. HTTPWroteBytesKey = "http_wrote_bytes" // #nosec // Deprecated: use semconv messaging attributes instead. HTTPSchemeKey = "http_scheme" // Deprecated: use semconv messaging attributes instead. HTTPFlavorKey = "http_flavor" // Deprecated: use semconv messaging attributes instead. HTTPRequestIDKey = "http_request_id" // Deprecated: use semconv messaging attributes instead. HTTPSessionIDKey = "http_session_id" // Deprecated: use semconv messaging attributes instead. HTTPTrackingIDKey = "http_tracking_id" // Deprecated: use semconv messaging attributes instead. HTTPRefererKey = "http_referer" )
const ( // Deprecated: use semconv messaging attributes instead. MessagingSystemKey = "messaging_system" // Deprecated: use semconv messaging attributes instead. MessagingDestinationKey = "messaging_destination" // Deprecated: use semconv messaging attributes instead. MessagingDestinationKindKey = "messaging_destination_kind" // Deprecated: use semconv messaging attributes instead. MessagingProtocolKey = "messaging_protocol" // Deprecated: use semconv messaging attributes instead. MessagingProtocolVersionKey = "messaging_protocol_version" // Deprecated: use semconv messaging attributes instead. MessagingURLKey = "messaging_url" // Deprecated: use semconv messaging attributes instead. MessagingMessageIDKey = "messaging_message_id" // Deprecated: use semconv messaging attributes instead. MessagingConversationIDKey = "messaging_conversation_id" // Deprecated: use semconv messaging attributes instead. MessagingMessagePayloadSizeBytesKey = "messaging_message_payload_size_bytes" // Deprecated: use semconv messaging attributes instead. MessagingMessagePayloadCompressedSizeBytesKey = "messaging_message_payload_compressed_size_bytes" )
const ( // Deprecated: use semconv messaging attributes instead. NetHostIPKey = "net_host_ip" // Deprecated: use semconv messaging attributes instead. NetHostPortKey = "net_host_port" )
const ( // Deprecated: use semconv messaging attributes instead. PeerServiceKey = "peer_service" // Deprecated: use semconv messaging attributes instead. ServiceTypeKey = "service_type" // Deprecated: use semconv messaging attributes instead. ServiceNameKey = "service_name" // Deprecated: use semconv messaging attributes instead. ServiceMethodKey = "service_method" // Deprecated: use semconv messaging attributes instead. ServiceNamespaceKey = "service_namespace" // Deprecated: use semconv messaging attributes instead. ServiceInstanceIDKey = "service_instance.id" // Deprecated: use semconv messaging attributes instead. ServiceVersionKey = "service_version" )
const ( // Deprecated: use semconv messaging attributes instead. StreamQueueKey = "queue" // Deprecated: use semconv messaging attributes instead. StreamSubjectKey = "subject" )
const ( SpanID = "span_id" TraceID = "trace_id" )
Variables ¶
This section is empty.
Functions ¶
func AtomicLevel ¶ added in v0.1.15
func AtomicLevel() zap.AtomicLevel
AtomicLevel return the configured atomic level
func AttributeKey ¶ added in v0.22.0
func FCodeInstance
deprecated
added in
v0.10.0
func FCodeMethod
deprecated
added in
v0.10.0
func FCodePackage
deprecated
added in
v0.10.20
func FDuration ¶
FDuration creates a zap.Field with a given time.Duration converted to milliseconds under the key "duration".
func FDurationFn ¶ added in v0.10.0
FDurationFn returns a function that returns a zap.Field with a given time.Duration converted to milliseconds under the key "duration".
func FDurationHour ¶ added in v0.10.0
FDurationHour creates a zap.Field with a given time.Duration converted to hours under the key "duration_hour".
func FDurationMin ¶ added in v0.10.0
FDurationMin creates a zap.Field with a given time.Duration converted to minutes under the key "duration_min".
func FDurationSec ¶ added in v0.10.0
FDurationSec creates a zap.Field with a given time.Duration converted to seconds under the key "duration_sec".
func FErrorType ¶
func FHTTPClientIP
deprecated
func FHTTPFlavor
deprecated
func FHTTPMethod
deprecated
func FHTTPReferer
deprecated
added in
v0.14.1
func FHTTPRequestContentLength
deprecated
func FHTTPRequestID
deprecated
func FHTTPScheme
deprecated
func FHTTPServerName
deprecated
added in
v0.2.0
func FHTTPSessionID
deprecated
added in
v0.2.0
func FHTTPStatusCode
deprecated
func FHTTPTarget
deprecated
func FHTTPTrackingID
deprecated
added in
v0.11.3
func FHTTPUserAgent
deprecated
func FHTTPWroteBytes
deprecated
func FMessagingConversationID
deprecated
added in
v0.2.0
func FMessagingDestination
deprecated
added in
v0.2.0
func FMessagingDestinationKind
deprecated
added in
v0.2.0
func FMessagingDestinationKind(value MessagingDestinationKind) zap.Field
Deprecated: use semconv messaging attributes instead.
func FMessagingMessageID
deprecated
added in
v0.2.0
func FMessagingMessagePayloadCompressedSizeBytes
deprecated
added in
v0.2.0
func FMessagingMessagePayloadSizeBytes
deprecated
added in
v0.2.0
func FMessagingProtocol
deprecated
added in
v0.2.0
func FMessagingProtocolVersion
deprecated
added in
v0.2.0
func FMessagingSystem
deprecated
added in
v0.2.0
func FMessagingURL
deprecated
added in
v0.2.0
func FNetHostIP
deprecated
func FNetHostPort
deprecated
func FPeerService
deprecated
func FServiceInstanceID
deprecated
func FServiceMethod
deprecated
func FServiceName
deprecated
func FServiceNamespace
deprecated
func FServiceType
deprecated
added in
v0.17.0
func FServiceVersion
deprecated
func FStackSkip ¶
func FStreamQueue
deprecated
added in
v0.5.0
func FStreamSubject
deprecated
added in
v0.5.0
func IsDisableCaller ¶ added in v0.1.15
func IsDisableCaller() bool
IsDisableCaller returns the configured disabled caller value
func IsDisableStacktrace ¶ added in v0.1.15
func IsDisableStacktrace() bool
IsDisableStacktrace returns the configured disabled stacktrace value
func SetDisableCaller ¶ added in v0.1.15
SetDisableCaller sets the given value and re-configures the logger
func SetDisableStacktrace ¶ added in v0.1.15
SetDisableStacktrace sets the given value and re-configures the logger
func WithAttributes ¶ added in v0.17.0
func WithHTTPClientIP ¶ added in v0.11.6
func WithHTTPFlavor ¶ added in v0.11.6
func WithHTTPReferer ¶ added in v0.14.1
func WithHTTPRequestID ¶ added in v0.11.6
func WithHTTPRequestOut ¶ added in v0.6.0
func WithHTTPScheme ¶ added in v0.11.6
func WithHTTPServerName ¶ added in v0.2.0
func WithHTTPSessionID ¶ added in v0.11.6
func WithHTTPTrackingID ¶ added in v0.11.6
Types ¶
type Labeler ¶ added in v0.14.0
type Labeler struct {
// contains filtered or unexported fields
}
func InjectLabeler ¶ added in v0.14.0
func LabelerFromContext ¶ added in v0.14.0
func LabelerFromContext(ctx context.Context, key LabelerContextKey) (*Labeler, bool)
type LabelerContextKey ¶ added in v0.14.0
type LabelerContextKey string
type MessagingDestinationKind
deprecated
added in
v0.2.0
type MessagingDestinationKind string
Deprecated: use semconv messaging attributes instead.
const ( // Deprecated: use semconv messaging attributes instead. MessagingDestinationKindQueue MessagingDestinationKind = "queue" // Deprecated: use semconv messaging attributes instead. MessagingDestinationKindTopic MessagingDestinationKind = "topic" )