infralog

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelDefault = levelInfo

	EnvironmentDevelopment = "development"
	EnvironmentProduction  = "production"
	EnvironmentDefault     = EnvironmentProduction
)

Variables

This section is empty.

Functions

func Debug

func Debug(message string, fields ...zap.Field)

func Error

func Error(message string, fields ...zap.Field)

func Fatal

func Fatal(message string, fields ...zap.Field)

func Info

func Info(message string, fields ...zap.Field)

func RegisterLogHandler

func RegisterLogHandler(handler func(entry *LogEntry))

func Setup

func Setup(cfg *Config) *zap.Logger

func Warn

func Warn(message string, fields ...zap.Field)

Types

type Config

type Config struct {
	Environment string
	Level       string
}

Config is a logger configuration structure.

func DefaultConfig

func DefaultConfig() *Config

func (*Config) GetLogLevel

func (c *Config) GetLogLevel() zapcore.Level

func (*Config) Validate

func (c *Config) Validate() error

type LogEntry

type LogEntry struct {
	Level   zapcore.Level
	Message string
	Fields  []zap.Field
}

func (*LogEntry) Error

func (e *LogEntry) Error() error

Error searches the first error in the list of entry's fields. Used to extract error from the log entry. We usually have only one error.

Jump to

Keyboard shortcuts

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