util

package
v0.0.0-...-4478dd3 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2019 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FORM_HEADER string = "application/x-www-form-urlencoded"
	JSON_HEADER string = "application/json; charset=UTF-8"
)

Variables

This section is empty.

Functions

func CacheData

func CacheData(data []byte, flag int, file string) (int, error)

func CallerPrettyfier

func CallerPrettyfier(f *runtime.Frame) (function string, file string)

func GetRandomString

func GetRandomString(index int, length int) string

*

  • 生成随机字符串
  • index:取随机序列的前index个
  • 0-9:10
  • 0-9a-z:10+24
  • 0-9a-zA-Z:10+24+24
  • length:需要生成随机字符串的长度

func LoadCacheData

func LoadCacheData(file string) ([]byte, error)

Types

type Log

type Log struct {
	ReportCaller bool
	Name         string
	Level        string
	Format       string

	LogOutChan chan string
	LogFile    *os.File
	// contains filtered or unexported fields
}

func (*Log) Create

func (log *Log) Create()

func (*Log) Init

func (log *Log) Init()

func (*Log) SetDefaults

func (log *Log) SetDefaults()

type Request

type Request struct {
	Client *http.Client
}

func NewRequest

func NewRequest() *Request

func (*Request) Request

func (r *Request) Request(method string, requestUrl string, data interface{}, contentType string) (result []byte, err error)

type WeChatLoggerHook

type WeChatLoggerHook struct {
	Name    string
	OutChan chan string
}

func NewWeChatLoggerHook

func NewWeChatLoggerHook(name string, outChan chan string) *WeChatLoggerHook

func (*WeChatLoggerHook) Fire

func (hook *WeChatLoggerHook) Fire(entry *logrus.Entry) error

func (*WeChatLoggerHook) Levels

func (hook *WeChatLoggerHook) Levels() []logrus.Level

Jump to

Keyboard shortcuts

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