util

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvOrDefault

func GetEnvOrDefault(key, fallback string) string

GetEnvOrDefault gets an environment variable value by key or return some default value.

func GetFinalElementOfPath

func GetFinalElementOfPath(inputPath string) string

GetFinalElementOfPath returns the final element of a path of the root. Makes use of the filepath library. Example path: /this/is/my/path returns path.

func InitLoggerWithLevel

func InitLoggerWithLevel(level *log.Level) (*log.Logger, error)

InitLoggerWithLevel creates a pointer to a logrus object. The logger defaults to the DEBUG level unless another logging level is passed as a function argument, or is specified under the environment variable LOG_LEVEL. the logger is configured to log to stdout. Returns an error if any.

func ParseTimeStringAsTimeOrNil

func ParseTimeStringAsTimeOrNil(timeString string, layout string) (*time.Time, error)

ParseTimeStringAsTimeOrNil parses a time string in the given format as either a go time.Time object or nil. Example format: "2009-01-02T01:02:32.111Z"

Types

This section is empty.

Jump to

Keyboard shortcuts

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