utils

package
v0.0.0-...-45ce995 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsString

func ContainsString(slice []string, searchTerm string) bool

func GenerateSurveyVersionID

func GenerateSurveyVersionID(oldVersions []*studyTypes.Survey) string

func InitLogger

func InitLogger(
	logLevel string,
	includeSrc bool,
	logToFile bool,
	logFilename string,
	logFileMaxSize int,
	logFileMaxAge int,
	logFileMaxBackups int,
	compressOldLogs bool,
)

func IsURLSafe

func IsURLSafe(value string) bool

check if a string value can be safely used as a part of an URL

func ParseDurationString

func ParseDurationString(value string) (time.Duration, error)

func ReadConfigFromEnvAndInitLogger

func ReadConfigFromEnvAndInitLogger(
	envLogLevel string,
	envLogIncludeSrc string,
	envLogToFile string,
	envLogFilename string,
	envLogMaxSize string,
	envLogMaxAge string,
	envLogMaxBackups string,
)

Types

type LoggerConfig

type LoggerConfig struct {
	LogToFile       bool   `json:"log_to_file" yaml:"log_to_file"`
	Filename        string `json:"filename" yaml:"filename"`
	MaxSize         int    `json:"max_size" yaml:"max_size"`
	MaxAge          int    `json:"max_age" yaml:"max_age"`
	MaxBackups      int    `json:"max_backups" yaml:"max_backups"`
	LogLevel        string `json:"log_level" yaml:"log_level"`
	IncludeSrc      bool   `json:"include_src" yaml:"include_src"`
	CompressOldLogs bool   `json:"compress_old_logs" yaml:"compress_old_logs"`
}

Jump to

Keyboard shortcuts

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