config

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 3 Imported by: 4

README

Config

Common configuration

Logger

Represents a logger configuration and ability to create a slog logger instance.

type Logger struct {
    Level  string // Logger level
    Format string // logger formatter
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitSlog

func InitSlog(cfg *Logger, version string, hook bool) *slog.Logger

InitSlog init slog logger instance with version field and hook for Sentry.

Types

type Logger

type Logger struct {
	Level LoggerLevel `yaml:"level" env:"LEVEL,required" valid:"required"`
	Fmt   string      `yaml:"fmt" env:"FMT,default=json"`
}

Logger represent configuration for any logger.

type LoggerLevel

type LoggerLevel string

LoggerLevel log levels.

const (
	LoggerLevelDebug LoggerLevel = "debug"
	LoggerLevelInfo  LoggerLevel = "info"
	LoggerLevelWarn  LoggerLevel = "warn"
	LoggerLevelError LoggerLevel = "error"
)

Jump to

Keyboard shortcuts

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