logger

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildInfoLogger

type BuildInfoLogger interface {
	LogBuildInfo(bld *buildinfo.BuildInfo)
	LogBuildInfoModules(bld *buildinfo.BuildInfo, modules ...string)
}

type Config

type Config struct {
	Level         zerolog.Level `env:"LOG_LEVEL" default:"warn" description:"Valid levels are: debug, info, warn, error, fatal, panic"`
	WithTimestamp bool          `env:"LOG_TIMESTAMP" default:"true" description:"Starts the log's line with a timestamp when true"`
}

type Logger

type Logger struct{ zerolog.Logger }

Logger wraps a zerolog.Logger and implements several log interfaces.

func New

func New(conf Config) *Logger

func NewDevelopmentLogger

func NewDevelopmentLogger(conf Config) *Logger

NewDevelopmentLogger returns a Logger configured for development environments.

func NewProductionLogger

func NewProductionLogger(conf Config) *Logger

NewProductionLogger returns a production ready Logger.

func (*Logger) LogAccess

func (l *Logger) LogAccess(_ context.Context, det accesslog.Details, req *http.Request)

LogAccess is part of the accesslog.Logger interface. Default log level is zerolog.InfoLevel. Every status code indicating an error is logged as zerolog.WarnLevel. All remaining requests to the [HealthCheckRoute] are logged as zerolog.DebugLevel

func (*Logger) LogBuildInfo

func (l *Logger) LogBuildInfo(bld *buildinfo.BuildInfo)

LogBuildInfo is part of the BuildInfoLogger interface.

func (*Logger) LogBuildInfoModules added in v0.2.0

func (l *Logger) LogBuildInfoModules(bld *buildinfo.BuildInfo, modules ...string)

LogBuildInfoModules is part of the BuildInfoLogger interface.

func (*Logger) LogHealthChanged

func (l *Logger) LogHealthChanged(status, oldStatus healthcheck.Status, details map[string]healthcheck.Status)

LogHealthChanged is part of the healthcheck.Logger interface.

func (*Logger) LogHealthCheckFailed

func (l *Logger) LogHealthCheckFailed(stat healthcheck.Status, err error)

LogHealthCheckFailed is part of the healthclient.Logger interface.

func (*Logger) LogHealthChecked

func (l *Logger) LogHealthChecked(stat healthcheck.Status)

LogHealthChecked is part of the healthclient.Logger interface.

func (*Logger) LogRegisterRoute

func (l *Logger) LogRegisterRoute(route serv.Route)

LogRegisterRoute is part of the RegisterRouteLogger interface.

func (*Logger) LogServerClose

func (l *Logger) LogServerClose(name string)

LogServerClose is part of the serv.Logger interface.

func (*Logger) LogServerShutdown

func (l *Logger) LogServerShutdown(name string)

LogServerShutdown is part of the serv.Logger interface.

func (*Logger) LogServerStart

func (l *Logger) LogServerStart(name, addr string)

LogServerStart is part of the serv.Logger interface.

func (*Logger) LogServerStartTLS

func (l *Logger) LogServerStartTLS(name, addr, certFile, keyFile string)

LogServerStartTLS is part of the serv.Logger interface.

func (*Logger) SetOTELLogger

func (l *Logger) SetOTELLogger()

SetOTELLogger is part of the OTELLoggerSetter interface.

type OTELLoggerSetter

type OTELLoggerSetter interface {
	SetOTELLogger()
}

type RegisterRouteLogger

type RegisterRouteLogger interface {
	LogRegisterRoute(route serv.Route)
}

Jump to

Keyboard shortcuts

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