logger

package
v0.0.0-...-09dd118 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLogger

func WithLogger(ctx context.Context, logger *Logger) context.Context

WithLogger adds a logger to the context

Types

type LogLevel

type LogLevel string

LogLevel represents the logging level

const (
	DebugLevel LogLevel = "debug"
	InfoLevel  LogLevel = "info"
	WarnLevel  LogLevel = "warn"
	ErrorLevel LogLevel = "error"
)

type Logger

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

Logger wraps the go-kit logger with additional convenience methods

func FromContext

func FromContext(ctx context.Context) *Logger

FromContext retrieves a logger from the context

func New

func New(logLevel LogLevel) *Logger

New creates a new logger with the specified level

func (*Logger) Debug

func (l *Logger) Debug(msg string, keyvals ...interface{})

Debug logs a debug message

func (*Logger) Error

func (l *Logger) Error(msg string, keyvals ...interface{})

Error logs an error message

func (*Logger) GetKitLogger

func (l *Logger) GetKitLogger() kitlog.Logger

GetKitLogger returns the underlying go-kit logger for advanced usage

func (*Logger) Info

func (l *Logger) Info(msg string, keyvals ...interface{})

Info logs an info message

func (*Logger) Warn

func (l *Logger) Warn(msg string, keyvals ...interface{})

Warn logs a warning message

func (*Logger) With

func (l *Logger) With(keyvals ...interface{}) *Logger

With returns a new logger with the given key-value pairs added to the context

Jump to

Keyboard shortcuts

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