logging

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Debug   string = "DEBUG"
	Info    string = "INFO"
	Warning string = "WARNING"
	Error   string = "ERROR"
)

Log levels.

Variables

View Source
var DefaultConfig = Config{
	Enabled:     true,
	Level:       Info,
	Caller:      true,
	Development: true,
}

DefaultConfig for logging.

Functions

func SetupWithConfig

func SetupWithConfig(config *Config)

SetupWithConfig updates the logger with the given config.

Types

type Config

type Config struct {
	Enabled     bool   `mapstructure:"enabled"`
	Level       string `mapstructure:"level"`
	Caller      bool   `mapstructure:"caller"`
	Development bool   `mapstructure:"development"`
	Output      string `mapstructure:"output"`
	Name        string `mapstructure:"name"`
}

Config represents the logging config.

type Logger

type Logger struct {
	*zap.SugaredLogger
	// contains filtered or unexported fields
}

Logger wraps zap.SugaredLogger to allow updating all the loggers.

func New

func New(_ string) *Logger

New returns a logger instance. TODO: use the name variable.

func (*Logger) ErrorStackTrace

func (l *Logger) ErrorStackTrace(err error)

ErrorStackTrace prints the stack trace present in the error type.

func (*Logger) WarnStackTrace

func (l *Logger) WarnStackTrace(err error)

WarnStackTrace prints the stack trace present in the error type as warning log.

Jump to

Keyboard shortcuts

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