utils

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LevelsDbg = map[string]zapcore.Level{
	"debug":   zap.DebugLevel,
	"info":    zap.InfoLevel,
	"warning": zap.WarnLevel,
	"error":   zap.ErrorLevel,
}

LevelsDbg is a reversed map of level macros and strings.

Functions

func GlobalDebugLevel

func GlobalDebugLevel() zapcore.Level

func RandomStr

func RandomStr(chars string, length int) string

RandomStr generates a random string within charset `chars` and shorter than length

func ReConvert

func ReConvert(ptn string) string

ReConvert does the pre-process of the regular expression literal. It does the following things: 1. Remove P before captured group names 2. Add parenthesises to the other parts of the log event string.

func SetGlobalDebugLevel

func SetGlobalDebugLevel(lvl string)

func StrIndex

func StrIndex(vs []string, t string) int

StrIndex is the helper function to find the position of a string in a []string

func StrSlice2DCopy

func StrSlice2DCopy(src [][]string) (cpy [][]string)

StrSlice2DCopy is a simple helper function to make a deep copy of a 2-dimensional string slice.

func XMLStr

func XMLStr(maxDepth int, maxElements int, seed []string) (string, error)

XMLStr returns an XML string with specified maximum depth and elements of each level

Types

type Logger

type Logger = zap.SugaredLogger

func GetSugaredLogger

func GetSugaredLogger() *Logger

Jump to

Keyboard shortcuts

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