utils

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alert

func Alert(msg string, v ...map[string]interface{})

Alert logs a message at alert level.

func Async

func Async(msgLen ...int64) *logs.BeeLogger

Async set the beelogger with Async mode and hold msglen messages

func CheckError

func CheckError(err error)

如果err != nil 记录日志

func CheckFatal

func CheckFatal(err error)

如果err != nil 记录日志并panic

func Critical

func Critical(msg string, v ...map[string]interface{})

Critical logs a message at critical level.

func Debug

func Debug(msg string, v ...map[string]interface{})

Debug logs a message at debug level.

func Emergency

func Emergency(msg string, v ...map[string]interface{})

Emergency logs a message at emergency level.

func Error

func Error(msg string, v ...map[string]interface{})

Error logs a message at error level.

func GetMimeType

func GetMimeType(name string) string

根据文件后缀获取文件的mimetype

func Go added in v0.1.6

func Go(callback func())

安全的goroutine

func Info

func Info(msg string, v ...map[string]interface{})

Info compatibility alias for Warning()

func Notice

func Notice(msg string, v ...map[string]interface{})

Notice logs a message at notice level.

func RandId added in v0.1.6

func RandId(length int) string

获取指定长度的随机字符串

func RandStr added in v0.1.6

func RandStr(l int) string

获取便于人类识别的随机字符串(避开了易混淆的字符1l0O等)

func Reset

func Reset()

Reset will remove all the adapter

func SetLogFuncCall

func SetLogFuncCall(b bool)

SetLogFuncCall set the CallDepth, default is 4

func SetLogLevel added in v0.1.6

func SetLogLevel(l int)

SetLevel sets the global log level used by the simple logger.

func SetLogPrefix added in v0.1.6

func SetLogPrefix(s string)

SetPrefix sets the prefix

func SetLogger

func SetLogger(adapter string, config ...string) error

设置日志 adapter console、file、multifile beego.SetLogger("file", `{"filename":"logs/test.log"}`)

func ToCamelString

func ToCamelString(s string) string

camel string, xx_yy to XxYy

func ToInt

func ToInt(value interface{}, defVal ...int) int

转换为int类型 value 可以是数字、数字字符串 如果value不能转换为数字,则返回默认值defVal defVal 提供默认值,如果没有,则视为0

func ToInt64

func ToInt64(value interface{}, defVal ...int64) int64

转换为int64类型 value 可以是数字、数字字符串 如果value不能转换为数字,则返回默认值defVal defVal 提供默认值,如果没有,则视为0

func ToSnakeString

func ToSnakeString(s string) string

snake string, XxYy to xx_yy , XxYY to xx_yy

func ToString

func ToString(value interface{}, defVal ...string) string

转换为字符串 如果value不能转换为字符串,则返回默认值defVal defVal 提供默认值,如果没有,则视为空字符串""

func Trace

func Trace(msg string, v ...map[string]interface{})

Trace logs a message at trace level. compatibility alias for Warning()

func Warn

func Warn(msg string, v ...map[string]interface{})

Warn compatibility alias for Warning()

Types

This section is empty.

Jump to

Keyboard shortcuts

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