log

package
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 13 Imported by: 21

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	CodeInstanceKey = "code_instance"
	CodePackageKey  = "code_package"
	CodeMethodKey   = "code_method"
	CodeLineKey     = "code_line"
)
View Source
const (
	DurationKey     = "duration"
	DurationSecKey  = "duration_sec"
	DurationMinKey  = "duration_min"
	DurationHourKey = "duration_hour"
)
View Source
const (
	ErrorTypeKey       = "error_type"
	ErrorMessageKey    = "error_message"
	ErrorStacktraceKey = "error_stacktrace"
)
View Source
const (
	// HTTPServerNameKey represents the name of the service handling the request
	HTTPServerNameKey = "http_server_name"

	// HTTPMethodKey represents the HTTP request method.
	HTTPMethodKey = "http_method"

	// HTTPTargetKey represents the full request target as passed in a HTTP
	// request line or equivalent, e.g. "/path/12314/?q=ddds#123".
	HTTPTargetKey = "http_target"

	// HTTPHostKey represents the value of the HTTP host header.
	HTTPHostKey = "http_host"

	// HTTPStatusCodeKey represents the HTTP response status code.
	HTTPStatusCodeKey = "http_status_code"

	// HTTPUserAgentKey represents the Value of the HTTP User-Agent header sent by the client.
	HTTPUserAgentKey = "http_user_agent"

	// HTTPClientIPKey represents the IP address of the original client behind all proxies,
	// if known (e.g. from X-Forwarded-For).
	HTTPClientIPKey = "http_client_ip"

	// HTTPRequestContentLengthKey represents the size of the request payload body in bytes.
	HTTPRequestContentLengthKey = "http_read_bytes"

	// HTTPWroteBytesKey represents the size of the response payload body in bytes.
	HTTPWroteBytesKey = "http_wrote_bytes" // #nosec

	// HTTPSchemeKey represents the URI scheme identifying the used protocol.
	HTTPSchemeKey = "http_scheme"

	// HTTPFlavorKey represents the Kind of HTTP protocol used.
	HTTPFlavorKey = "http_flavor"

	// HTTPRequestIDKey represents the HTTP request id if known (e.g. from X-Request-ID).
	HTTPRequestIDKey = "http_request_id"

	// HTTPSessionIDKey represents the HTTP session id if known (e.g. from X-Session-ID).
	HTTPSessionIDKey = "http_session_id"

	// HTTPTrackingIDKey represents the HTTP tracking id if known (e.g. from X-Tracking-ID).
	HTTPTrackingIDKey = "http_tracking_id"
)
View Source
const (
	MessagingSystemKey                            = "messaging_system"
	MessagingDestinationKey                       = "messaging_destination"
	MessagingDestinationKindKey                   = "messaging_destination_kind"
	MessagingProtocolKey                          = "messaging_protocol"
	MessagingProtocolVersionKey                   = "messaging_protocol_version"
	MessagingURLKey                               = "messaging_url"
	MessagingMessageIDKey                         = "messaging_message_id"
	MessagingConversationIDKey                    = "messaging_conversation_id"
	MessagingMessagePayloadSizeBytesKey           = "messaging_message_payload_size_bytes"
	MessagingMessagePayloadCompressedSizeBytesKey = "messaging_message_payload_compressed_size_bytes"
)
View Source
const (
	// NetHostIPKey represents the local host IP. Useful in case of a multi-IP host.
	NetHostIPKey = "net_host_ip"

	// NetHostPortKey represents the local host port.
	NetHostPortKey = "net_host_port"
)
View Source
const (
	// ServiceNameKey represents the NameKey of the service.
	ServiceNameKey = "service_name"

	// ServiceMethodKey represents the Method of the service.
	ServiceMethodKey = "service_method"

	// ServiceNamespaceKey represents a namespace for `service.name`. This needs to
	// have meaning that helps to distinguish a group of services. For example, the
	// team name that owns a group of services. `service.name` is expected to be
	// unique within the same namespace.
	ServiceNamespaceKey = "service_namespace"

	// ServiceInstanceIDKey represents a unique identifier of the service instance. In conjunction
	// with the `service.name` and `service.namespace` this must be unique.
	ServiceInstanceIDKey = "service_instance.id"

	// ServiceVersionKey represents the version of the service API.
	ServiceVersionKey = "service_version"
)
View Source
const (
	StreamQueueKey   = "queue"
	StreamSubjectKey = "subject"
)
View Source
const (
	ModeDev  = "dev"
	ModeProd = "prod"
)
View Source
const (
	// PeerServiceKey represents the ServiceNameKey name of the remote service.
	// Should equal the actual `service.name` resource attribute of the remote service, if any.
	PeerServiceKey = "peer_service"
)
View Source
const (
	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 FCodeInstance added in v0.10.0

func FCodeInstance(v string) zap.Field

func FCodeLine added in v0.10.0

func FCodeLine(v int) zap.Field

func FCodeMethod added in v0.10.0

func FCodeMethod(v string) zap.Field

func FCodePackage added in v0.10.20

func FCodePackage(v string) zap.Field

func FDuration

func FDuration(duration time.Duration) zap.Field

func FDurationFn added in v0.10.0

func FDurationFn() func() zap.Field

func FDurationHour added in v0.10.0

func FDurationHour(duration time.Duration) zap.Field

func FDurationMin added in v0.10.0

func FDurationMin(duration time.Duration) zap.Field

func FDurationSec added in v0.10.0

func FDurationSec(duration time.Duration) zap.Field

func FError

func FError(err error) zap.Field

func FErrorType

func FErrorType(err error) zap.Field

func FHTTPClientIP

func FHTTPClientIP(clientIP string) zap.Field

func FHTTPFlavor

func FHTTPFlavor(flavor string) zap.Field

func FHTTPHost

func FHTTPHost(host string) zap.Field

func FHTTPMethod

func FHTTPMethod(name string) zap.Field

func FHTTPRequestContentLength

func FHTTPRequestContentLength(bytes int64) zap.Field

func FHTTPRequestID

func FHTTPRequestID(id string) zap.Field

func FHTTPScheme

func FHTTPScheme(scheme string) zap.Field

func FHTTPServerName added in v0.2.0

func FHTTPServerName(id string) zap.Field

func FHTTPSessionID added in v0.2.0

func FHTTPSessionID(id string) zap.Field

func FHTTPStatusCode

func FHTTPStatusCode(status int) zap.Field

func FHTTPTarget

func FHTTPTarget(target string) zap.Field

func FHTTPTrackingID added in v0.11.3

func FHTTPTrackingID(id string) zap.Field

func FHTTPUserAgent

func FHTTPUserAgent(userAgent string) zap.Field

func FHTTPWroteBytes

func FHTTPWroteBytes(bytes int64) zap.Field

func FJSON added in v0.12.0

func FJSON(v interface{}) zap.Field

FJSON - returns zap field

func FMessagingConversationID added in v0.2.0

func FMessagingConversationID(value string) zap.Field

func FMessagingDestination added in v0.2.0

func FMessagingDestination(value string) zap.Field

func FMessagingDestinationKind added in v0.2.0

func FMessagingDestinationKind(value MessagingDestinationKind) zap.Field

func FMessagingMessageID added in v0.2.0

func FMessagingMessageID(value string) zap.Field

func FMessagingMessagePayloadCompressedSizeBytes added in v0.2.0

func FMessagingMessagePayloadCompressedSizeBytes(value string) zap.Field

func FMessagingMessagePayloadSizeBytes added in v0.2.0

func FMessagingMessagePayloadSizeBytes(value string) zap.Field

func FMessagingProtocol added in v0.2.0

func FMessagingProtocol(value string) zap.Field

func FMessagingProtocolVersion added in v0.2.0

func FMessagingProtocolVersion(value string) zap.Field

func FMessagingSystem added in v0.2.0

func FMessagingSystem(value string) zap.Field

func FMessagingURL added in v0.2.0

func FMessagingURL(value string) zap.Field

func FName

func FName(name string) zap.Field

FName - returns zap field

func FNetHostIP

func FNetHostIP(ip string) zap.Field

func FNetHostPort

func FNetHostPort(port string) zap.Field

func FNum

func FNum(num int) zap.Field

FNum - returns zap field

func FPeerService

func FPeerService(name string) zap.Field

func FServiceInstanceID

func FServiceInstanceID(id string) zap.Field

func FServiceMethod

func FServiceMethod(method string) zap.Field

func FServiceName

func FServiceName(name string) zap.Field

func FServiceNamespace

func FServiceNamespace(namespace string) zap.Field

func FServiceVersion

func FServiceVersion(version string) zap.Field

func FStackSkip

func FStackSkip(skip int) zap.Field

func FStreamQueue added in v0.5.0

func FStreamQueue(queue string) zap.Field

func FStreamSubject added in v0.5.0

func FStreamSubject(name string) zap.Field

func FTraceID

func FTraceID(traceID string) zap.Field

func FValue

func FValue(value interface{}) zap.Field

FValue - returns zap field

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 Logger

func Logger() *zap.Logger

Logger return the logger instance

func Must

func Must(l *zap.Logger, err error, msgAndArgs ...interface{})

Must logs a fatal error if given

func SetDisableCaller added in v0.1.15

func SetDisableCaller(value bool) error

SetDisableCaller sets the given value and re-configures the logger

func SetDisableStacktrace added in v0.1.15

func SetDisableStacktrace(value bool) error

SetDisableStacktrace sets the given value and re-configures the logger

func With added in v0.2.4

func With(l *zap.Logger, fields ...zap.Field) *zap.Logger

func WithError

func WithError(l *zap.Logger, err error) *zap.Logger

func WithHTTPClientIP added in v0.11.6

func WithHTTPClientIP(l *zap.Logger, r *http.Request) *zap.Logger

func WithHTTPFlavor added in v0.11.6

func WithHTTPFlavor(l *zap.Logger, r *http.Request) *zap.Logger

func WithHTTPHost added in v0.11.6

func WithHTTPHost(l *zap.Logger, r *http.Request) *zap.Logger

func WithHTTPRequest

func WithHTTPRequest(l *zap.Logger, r *http.Request) *zap.Logger

func WithHTTPRequestID added in v0.11.6

func WithHTTPRequestID(l *zap.Logger, r *http.Request) *zap.Logger

func WithHTTPRequestOut added in v0.6.0

func WithHTTPRequestOut(l *zap.Logger, r *http.Request) *zap.Logger

func WithHTTPScheme added in v0.11.6

func WithHTTPScheme(l *zap.Logger, r *http.Request) *zap.Logger

func WithHTTPServerName added in v0.2.0

func WithHTTPServerName(l *zap.Logger, name string) *zap.Logger

func WithHTTPSessionID added in v0.11.6

func WithHTTPSessionID(l *zap.Logger, r *http.Request) *zap.Logger

func WithHTTPTrackingID added in v0.11.6

func WithHTTPTrackingID(l *zap.Logger, r *http.Request) *zap.Logger

func WithServiceName

func WithServiceName(l *zap.Logger, name string) *zap.Logger

func WithTraceID

func WithTraceID(l *zap.Logger, ctx context.Context) *zap.Logger

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

func Configure

func Configure(l *zap.Logger) *Config

func (*Config) Error

func (c *Config) Error(err error) *Config

func (*Config) HTTPRequest

func (c *Config) HTTPRequest(r *http.Request) *Config

func (*Config) Logger

func (c *Config) Logger() *zap.Logger

func (*Config) With

func (c *Config) With(fields ...zap.Field) *Config

type MessagingDestinationKind added in v0.2.0

type MessagingDestinationKind string
const (
	MessagingDestinationKindQueue MessagingDestinationKind = "queue"
	MessagingDestinationKindTopic MessagingDestinationKind = "topic"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL