stdlogfmt

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

Logger wraps a standard library logger and adapts it to pkg/log.

func New

func New(opts ...Option) *Logger

New creates a new logger that adapts the Go standard log package to Logger.

func (*Logger) Debug

func (l *Logger) Debug(args ...interface{})

Info logs using the "debug" level

func (*Logger) Info

func (l *Logger) Info(args ...interface{})

Info logs using the "info" level

func (*Logger) With

func (l *Logger) With(args ...interface{}) log.Logger

With creates a new logger using args as context

type Option added in v0.4.0

type Option func(*Logger)

func WithCallerDepth added in v0.4.0

func WithCallerDepth(depth int) Option

WithCallerDepth sets the call depth of the logger for filename and line logging. Set depth to 0 to disable filename and line logging.

func WithDebug added in v0.4.0

func WithDebug() Option

WithDebug turns on debug logging.

func WithDebugFlag added in v0.4.0

func WithDebugFlag(flag bool) Option

WithDebugFlag sets debug logging on or off.

func WithLogger added in v0.4.0

func WithLogger(logger *stdlog.Logger) Option

WithLogger sets the Go standard logger to use.

func WithoutTimestamp added in v0.4.0

func WithoutTimestamp() Option

WithoutTimestamp disables outputting an RFC3339 timestamp.

Jump to

Keyboard shortcuts

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