utils

package
v1.4.3-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLog

func AddLog(l1 _log.Logger)

AddLog to add logger chain.

func Ellipsis

func Ellipsis(str string, length int) string

Ellipsis to truncate string.

func Error

func Error(str string, args ...interface{})

Error to print error.

func Fatal

func Fatal(str string, args ...interface{})

Fatal to log fatal.

func GetKey

func GetKey(params ...interface{}) string

GetKey to generate cache key.

func GetLogger

func GetLogger(i ...int) _log.Logger

GetLogger to get logger.

func Info

func Info(str string, args ...interface{})

Info to log info.

func InitLog

func InitLog(lvl log.LogLevel, json, color bool) (err error)

InitLog to init global logger.

func Log

func Log(field map[string]interface{})

Log to log with custom field.

func PadLeft

func PadLeft(str string, l int, p string) string

PadLeft to pad string to the left.

func PadRight

func PadRight(str string, l int, p string) string

PadRight to pad string to the right.

func ParseDuration added in v0.0.2

func ParseDuration(isoDuration string) time.Duration

ParseDuration parses an ISO 8601 string representing a duration, and returns the resultant golang time.Duration instance.

func Repeat

func Repeat(str string, n int) string

Repeat to repeat string.

func Thousands added in v0.0.2

func Thousands(num int) string

Thousands to format int to thousands string format.

Types

This section is empty.

Jump to

Keyboard shortcuts

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