logging

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEchoZerlogLogger

func NewEchoZerlogLogger(logger *zerolog.Logger) echo.MiddlewareFunc

NewEchoZerlogLogger builds a logging middleware with default config.

func NewEchoZerlogLoggerWithConfig

func NewEchoZerlogLoggerWithConfig(logger *zerolog.Logger, config middleware.RequestLoggerConfig) echo.MiddlewareFunc

NewEchoZerlogLoggerWithConfig builds a logging middleware with custom config.

func NewZerlogRequestLogger

func NewZerlogRequestLogger(
	logger *zerolog.Logger,
) func(ctx echo.Context, values middleware.RequestLoggerValues) error

NewZerlogRequestLogger generates the logger function being used by the logging middleware.

Types

type GormLogger

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

GormLogger handles logging of gorm logs.

func NewGormLogger

func NewGormLogger(logger *zerolog.Logger) *GormLogger

NewGormLogger creates a new GormLogger.

func (*GormLogger) Error

func (gl *GormLogger) Error(_ context.Context, message string, data ...interface{})

Error logs on error level.

func (*GormLogger) Info

func (gl *GormLogger) Info(_ context.Context, message string, data ...interface{})

Info logs on info level.

func (*GormLogger) LogMode

func (gl *GormLogger) LogMode(logger.LogLevel) logger.Interface

LogMode should change the loggers log level. zerlog does not need this change on the fly. The function just exists to satisfy the logger.Interface.

func (*GormLogger) Trace

func (gl *GormLogger) Trace(
	_ context.Context,
	begin time.Time,
	fc func() (sql string, rowsAffected int64),
	err error,
)

Trace logs on trace level. This logging function has a lot more information. It is used to log SQL statements generated by gorm, for example.

func (*GormLogger) Warn

func (gl *GormLogger) Warn(_ context.Context, message string, data ...interface{})

Warn logs on warn level.

Jump to

Keyboard shortcuts

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