Documentation
¶
Overview ¶
Package logmod provides OpenTelemetry trace provider as a module.
Index ¶
Examples ¶
Constants ¶
const ErrMissingProvider = errStr("log provider not set")
const ID = "logmod"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Opt ¶
func WithEnv ¶ added in v0.1.5
func WithEnv() Opt
WithEnv uses OTEL_EXPORTER_OTLP_TRACES_PROTO and OTEL_EXPORTER_OTLP_PROTO environment variable to set exporter. Accepted values are:
- http
- grpc
- stdout
If no value is provided, stdout is used.
func WithGRPC ¶
func WithGRPC() Opt
WithGRPC creates log provider with batch processor using grpc exporter from OTEL_* env configs. Env variables: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc
func WithHTTP ¶
func WithHTTP() Opt
WithHTTP creates log provider with batch processor using http exporter from OTEL_* env configs. Env variables: https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp
func WithProvider ¶
func WithProvider(exp *log.LoggerProvider) Opt
WithProvider sets the underlying trace provider for module.
func WithProviderFn ¶
func WithProviderFn(fn func() (*log.LoggerProvider, error)) Opt
WithProviderFn sets the underlying trace provider for module using given function.
func WithStdout ¶ added in v0.1.5
WithStdout creates log provider with stdout exporter.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func New ¶
New creates log provider module with sane defaults if no options are provided. Default options are: WithEnv. For instructions on how to integrate log provider with logger of your choice, see the list of ready made bridge libraries: https://opentelemetry.io/ecosystem/registry/?language=go&component=log-bridge
Example ¶
package main import ( "github.com/go-srvc/mods/logmod" "github.com/go-srvc/srvc" ) func main() { srvc.RunAndExit( logmod.New(), ) }
Output: