Documentation
¶
Index ¶
- Constants
- func ContextWithLogger(ctx context.Context, logger *Logger) context.Context
- func DPanic(msg string)
- func DPanicf(template string, args ...interface{})
- func Debug(msg string)
- func Debugf(template string, args ...interface{})
- func Error(msg string)
- func Errorf(template string, args ...interface{})
- func Fatal(msg string)
- func Fatalf(template string, args ...interface{})
- func Info(msg string)
- func Infof(template string, args ...interface{})
- func InitLogger(config Config)
- func IsOpenTelemetryActive() bool
- func L() *zap.Logger
- func Panic(msg string)
- func Panicf(template string, args ...interface{})
- func RegisterOpenTelemetryProvider(provider OpenTelemetryProvider)
- func ReplaceGlobals(logger *zap.Logger) func()
- func S() *zap.SugaredLogger
- func SetGlobalConfig(config Config) func()
- func ShutdownOpenTelemetryLogger(ctx context.Context) error
- func Sync() error
- func Warn(msg string)
- func Warnf(template string, args ...interface{})
- type Config
- type Field
- type Logger
- func (l *Logger) DPanic(msg string)
- func (l *Logger) DPanicf(template string, args ...interface{})
- func (l *Logger) Debug(msg string)
- func (l *Logger) Debugf(template string, args ...interface{})
- func (l *Logger) Error(msg string)
- func (l *Logger) Errorf(template string, args ...interface{})
- func (l *Logger) Fatal(msg string)
- func (l *Logger) Fatalf(template string, args ...interface{})
- func (l *Logger) GetZapLogger() *zap.Logger
- func (l *Logger) Info(msg string)
- func (l *Logger) Infof(template string, args ...interface{})
- func (l *Logger) IsDebugEnabled() bool
- func (l *Logger) Panic(msg string)
- func (l *Logger) Panicf(template string, args ...interface{})
- func (l *Logger) Warn(msg string)
- func (l *Logger) Warnf(template string, args ...interface{})
- func (l *Logger) WithFields(fields ...zap.Field) *Logger
- type OpenTelemetryConfig
- type OpenTelemetryManager
- type OpenTelemetryProvider
Constants ¶
View Source
const (
ConsoleEncode = "console"
)
View Source
const (
RequestIDKey = "request_id"
)
Variables ¶
This section is empty.
Functions ¶
func ContextWithLogger ¶
func InitLogger ¶
func InitLogger(config Config)
func IsOpenTelemetryActive ¶ added in v0.23.0
func IsOpenTelemetryActive() bool
IsOpenTelemetryActive checks if OpenTelemetry is currently active and working
func RegisterOpenTelemetryProvider ¶ added in v0.23.0
func RegisterOpenTelemetryProvider(provider OpenTelemetryProvider)
RegisterOpenTelemetryProvider allows external packages to register OpenTelemetry implementation
func ReplaceGlobals ¶ added in v0.19.2
func S ¶ added in v0.19.2
func S() *zap.SugaredLogger
func SetGlobalConfig ¶ added in v0.19.2
func SetGlobalConfig(config Config) func()
func ShutdownOpenTelemetryLogger ¶ added in v0.23.0
ShutdownOpenTelemetryLogger gracefully shuts down the OpenTelemetry logger
Types ¶
type Config ¶
type Config struct {
Level string `json:"level"`
Encoding string `json:"encoding"`
OpenTelemetry *OpenTelemetryConfig `json:"opentelemetry,omitempty"`
}
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func GetLoggerFromContext ¶
func NewDevelopmentLogger ¶ added in v0.20.0
func NewNopLogger ¶ added in v0.20.0
func NewNopLogger() *Logger
func (*Logger) GetZapLogger ¶ added in v0.23.0
GetZapLogger returns the underlying zap.Logger instance This method is primarily intended for testing and advanced use cases
func (*Logger) IsDebugEnabled ¶ added in v0.15.1
type OpenTelemetryConfig ¶ added in v0.23.0
type OpenTelemetryConfig struct {
Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`
Endpoint string `json:"endpoint" yaml:"endpoint" mapstructure:"endpoint"`
ServiceName string `json:"service_name" yaml:"service_name" mapstructure:"service_name"`
ServiceVersion string `json:"service_version,omitempty" yaml:"service_version,omitempty" mapstructure:"service_version,omitempty"`
Environment string `json:"environment,omitempty" yaml:"environment,omitempty" mapstructure:"environment,omitempty"`
Hostname string `json:"hostname,omitempty" yaml:"hostname,omitempty" mapstructure:"hostname,omitempty"`
Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty" mapstructure:"headers,omitempty"`
Insecure bool `json:"insecure,omitempty" yaml:"insecure,omitempty" mapstructure:"insecure,omitempty"`
Protocol string `json:"protocol,omitempty" yaml:"protocol,omitempty" mapstructure:"protocol,omitempty"` // "grpc" or "http"
}
OpenTelemetryConfig holds OpenTelemetry logging configuration
type OpenTelemetryManager ¶ added in v0.23.0
type OpenTelemetryManager struct {
// contains filtered or unexported fields
}
OpenTelemetryManager manages OpenTelemetry providers in a thread-safe way
Click to show internal directories.
Click to hide internal directories.