shared

package
v0.0.0-...-cd00529 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIPinAccessList

func CheckIPinAccessList(ip net.IP, ipAccessList string) bool

CheckIPinAccessList checks if ip addresses is in one of the subnets of IP ACL

func GetCurrentTimeMilliseconds

func GetCurrentTimeMilliseconds() int64

GetCurrentTimeMilliseconds returns current epoch time in milliseconds

func LoadYAMLConfiguration

func LoadYAMLConfiguration(filename *string, config interface{}) (interface{}, error)

LoadYAMLConfiguration loads a configuration file and parses it as YAML

func NewLogger

func NewLogger(applicationName string, config *Logger) *zap.Logger

NewLogger returns a new logger

func ServeEmbedDirectory

func ServeEmbedDirectory(filesystem fs.FS, embedPath string) gin.HandlerFunc

ServeEmbedDirectory serves a directory from an embedded filesystem, directory must provided via gin's URL param field ":path"

func ServeEmbedFile

func ServeEmbedFile(filesystem fs.FS, embedFilePath string) gin.HandlerFunc

ServeEmbedFile serves one file from an embedded filesystem

func TimeMillisecondsToInt64

func TimeMillisecondsToInt64(timestamp time.Time) int64

TimeMillisecondsToInt64 returns time.Time as int64, if not set -1 will be returned

func TimeMillisecondsToString

func TimeMillisecondsToString(timestamp int64) string

TimeMillisecondsToString return timestamp as string in UTC

Types

type Logger

type Logger struct {

	// Logging level of this logger
	Level string

	// Filename is the file to write logs to.  Backup log files will be retained
	// in the same directory.
	Filename string

	// MaxSize is the maximum size in megabytes of the log file before it gets
	// rotated. It defaults to 100 megabytes.
	MaxSize int

	// MaxAge is the maximum number of days to retain old log files based on the
	// timestamp encoded in their filename.  Note that a day is defined as 24
	// hours and may not exactly correspond to calendar days due to daylight
	// savings, leap seconds, etc. The default is not to remove old log files
	// based on age.
	MaxAge int

	// MaxBackups is the maximum number of old log files to retain.  The default
	// is to retain all old log files (though MaxAge may still cause them to get
	// deleted.)
	MaxBackups int
	// contains filtered or unexported fields
}

Logger holds our log file configuration

func (*Logger) Rotate

func (l *Logger) Rotate()

Rotate closes and reopens logfile so old logfiles can be expired.

Jump to

Keyboard shortcuts

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