util

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 16 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig(path string, cfg any, envKeywordParsers map[string]envldr.Parser, envTypeParsers map[reflect.Type]envldr.Parser, envKindParsers map[reflect.Kind]envldr.Parser) error

func NewLogger

func NewLogger(config LoggerConfig) (logger *log_level.Logger, out *os.File, err error)

func NewUnixListener

func NewUnixListener(path string, uid int, gid int, mode fs.FileMode) (listener *net.UnixListener, err error)

func PrintInfo

func PrintInfo(items ...string)

func ToJsonStr

func ToJsonStr(v any) (str string)

Types

type LogFileError

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

func (*LogFileError) Error

func (e *LogFileError) Error() string

func (*LogFileError) Unwrap

func (e *LogFileError) Unwrap() error

type LoggerConfig

type LoggerConfig struct {
	Level        level.Level `json:"level" env_var:"LOGGER_LEVEL"`
	Utc          bool        `json:"utc" env_var:"LOGGER_UTC"`
	Path         string      `json:"path" env_var:"LOGGER_PATH"`
	FileName     string      `json:"file_name" env_var:"LOGGER_FILE_NAME"`
	Terminal     bool        `json:"terminal" env_var:"LOGGER_TERMINAL"`
	Microseconds bool        `json:"microseconds" env_var:"LOGGER_MICROSECONDS"`
	Prefix       string      `json:"prefix" env_var:"LOGGER_PREFIX"`
}

type SecretString

type SecretString string

func (SecretString) MarshalJSON

func (s SecretString) MarshalJSON() ([]byte, error)

func (SecretString) String

func (s SecretString) String() string

func (*SecretString) UnmarshalJSON

func (s *SecretString) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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