modulepackage
0.0.0-20240515122000-be5f7eea69b1
Repository: https://github.com/sourcegraph/log.git
Documentation: pkg.go.dev
# README
github.com/sourcegraph/log
OpenTelemetry-compatible Zap logger for Sourcegraph (formerly
lib/log
)
Learn more:
# Functions
Error is shorthand for the common idiom NamedError("error", err).
Init initializes the log package's global logger as a logger of the given resource.
NamedError constructs a field that logs err.Error() under the provided key.
NewSentrySink instantiates a Sentry sink to provide to `log.Init` with the following default values: - SampleRate: 0.1 To provide different values see `NewSentrySinkWith`.
NewSentrySinkWith instantiates a Sentry sink to provide to `log.Init` with the values provided in SentrySink.
NoOp returns a no-op Logger that can never produce any output.
Object constructs a field that places all the given fields within the given key's namespace.
Scoped returns the global logger and sets it up with the given scope and OpenTelemetry compliant implementation.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
LevelNone silences all log output.
No description provided by the author
# Variables
Binary constructs a field that carries an opaque binary blob.
Bool constructs a field that carries a bool.
Boolp constructs a field that carries a *bool.
Duration constructs a field with the given key and value.
Durationp constructs a field that carries a *time.Duration.
EnvDevelopment is key of the environment variable that is used to set whether to use development logger configuration on Init.
EnvLogFormat is key of the environment variable that is used to set the log format on Init.
EnvLogLevel is key of the environment variable that can be used to set the log level on Init.
EnvLogSamplingInitial is key of the environment variable that can be used to set the number of entries with identical messages to always output per second.
EnvLogSamplingThereafter is key of the environment variable that can be used to set the number of entries with identical messages to discard before emitting another one per second, after EnvLogSamplingInitial.
EnvLogScopeLevel is key of the environment variable that can be used to override the log level for specific scopes and its children.
Float32 constructs a field that carries a float32.
Float32p constructs a field that carries a *float32.
Float32s constructs a field that carries a slice of floats.
Float64 constructs a field that carries a float64.
Float64p constructs a field that carries a *float64.
Float64s constructs a field that carries a slice of floats.
Int constructs a field with the given key and value.
Int32 constructs a field with the given key and value.
Int32p constructs a field that carries a *int32.
Int32s constructs a field that carries a slice of 32 bit integers.
Int64 constructs a field with the given key and value.
Int64p constructs a field that carries a *int64.
Int64s constructs a field that carries a slice of integers.
Intp constructs a field that carries a *int.
Ints constructs a field that carries a slice of integers.
Namespace creates a named, isolated scope within the logger's context.
String constructs a field with the given key and value.
Stringp constructs a field that carries a *string.
Strings constructs a field that carries a slice of strings.
Time constructs a Field with the given key and value.
Timep constructs a field that carries a *time.Time.
Uint constructs a field with the given key and value.
Uint32 constructs a field with the given key and value.
Uint32p constructs a field that carries a *uint32.
Uint64 constructs a field with the given key and value.
Uint64p constructs a field that carries a *uint64.
Uintp constructs a field that carries a *uint.
# Structs
PostInitCallbacks is a set of callbacks returned by Init that enables finalization and updating of any configured sinks.
SentrySink reports all warning-level and above log messages that contain an error field (via the `log.Error(err)` or `log.NamedError(name, err)` field constructors) to Sentry, complete with stacktrace data and any additional context logged in the corresponding log message (including anything accumulated on a sub-logger).
SinksConfig describes unified configuration for all sinks.
# Type aliases
A Field is a marshaling operation used to add a key-value pair to a logger's context.
No description provided by the author
No description provided by the author
SinksConfigGetter should provide the latest SinksConfig to update sink configuration.
TraceContext represents a trace to associate with log entries.