telemetry

package
v0.0.0-...-df6d72d Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(cfg *LogConfig) (*zap.Logger, error)

func NewLoggerMock

func NewLoggerMock() *zap.Logger

Types

type Config

type Config struct {
	LogConfig *LogConfig        `yaml:"logging" validate:"required"`
	Resource  map[string]string `yaml:"resource"`
}

func DefaultConfig

func DefaultConfig() *Config

type LogConfig

type LogConfig struct {
	// Level is the minimum enabled logging level.
	Level zapcore.Level `yaml:"level"`

	// Encoding sets the logger's encoding. Valid values are "json", "console"
	Encoding string `yaml:"encoding"`

	// DisableCaller stops annotating logs with the calling function's file name and line number.
	// By default, all logs are annotated.
	DisableCaller bool `yaml:"disable_caller"`

	// DisableStacktrace completely disables automatic stacktrace capturing. By
	// default, stacktraces are captured for WarnLevel and above logs in
	// development and ErrorLevel and above in production.
	DisableStacktrace bool `yaml:"disable_stacktrace"`

	// OutputPaths is a list of URLs or file paths to write logging output to.
	OutputPaths []string `yaml:"output_paths"`

	// InitialFields is a collection of fields to add to the root logger.
	InitialFields map[string]interface{} `yaml:"initial_fields"`
}

func DefaultLogConfig

func DefaultLogConfig() *LogConfig

func (*LogConfig) ToZapConfig

func (c *LogConfig) ToZapConfig() *zap.Config

type Telemetry

type Telemetry struct {
	Config *Config
	Logger *zap.Logger
}

func NewTelemetry

func NewTelemetry(cfg *Config) (*Telemetry, error)

func NewTelemetryMock

func NewTelemetryMock() *Telemetry

NewTelemetryMock returns Telemetry object with NoOp loggers, meters, tracers

func (Telemetry) L

func (t Telemetry) L() *zap.Logger

Jump to

Keyboard shortcuts

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