utils

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2021 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package utils @Description:

Package utils @Description:

Index

Constants

This section is empty.

Variables

Functions

func Black

func Black(str string) string

func Blue

func Blue(str string) string

func Cyan

func Cyan(str string) string

func GetLogLevel

func GetLogLevel(level string) []log.Level

GetLogLevel 获取日志等级

可能的值有

"trace","debug","info","warn","warn","error"

func GetPWScreen

func GetPWScreen(url string, device string) ([]byte, error)

func Green

func Green(str string) string

func PathExists added in v1.0.24

func PathExists(path string) (bool, error)

PathExists *

  • @Description: 判断文件或文件夹是否存在 如果返回的错误为nil,说明文件或文件夹存在 如果返回的错误类型使用os.IsNotExist()判断为true,说明文件或文件夹不存在 如果返回的错误为其它类型,则不确定是否在存在
  • @param path
  • @return bool
  • @return error
  • example

func Purple

func Purple(str string) string

func PwInit added in v1.0.26

func PwInit()

func Red

func Red(str string) string

func SearchImage

func SearchImage(ketWord string) ([]string, error)

SearchImage *

  • @Description:
  • @param ketWord
  • @return []string
  • @return error
  • example

func SetConfig added in v1.1.0

func SetConfig(enable bool)

func White

func White(str string) string

func WriteToFile added in v1.0.24

func WriteToFile(name string, data []byte) error

func Yellow

func Yellow(str string) string

Types

type LogFormat

type LogFormat struct {
	TimeStampFormat string `json:"time_stamp_format"`

	LogContent string `json:"log_content"`

	LogTruncate bool `json:"log_truncate"`
}

func (*LogFormat) Format

func (f *LogFormat) Format(entry *log.Entry) ([]byte, error)

Format *

  • @Description:
  • @receiver f
  • @param entry
  • @return []byte
  • @return error
  • example

type LogHook

type LogHook struct {
	EnableLogChan bool

	LogChan chan string
	// contains filtered or unexported fields
}

LogHook @Description:

func NewLogHook

func NewLogHook(formatter log.Formatter, levels []log.Level, writers ...io.Writer) *LogHook

NewLogHook *

  • @Description:
  • @param formatter
  • @param levels
  • @param writers
  • @return *LogHook
  • example

func (*LogHook) AddWriter

func (l *LogHook) AddWriter(writer ...io.Writer)

AddWriter *

  • @Description:
  • @receiver l
  • @param writer
  • example

func (*LogHook) Fire

func (l *LogHook) Fire(entry *log.Entry) error

Fire *

  • @Description:
  • @receiver l
  • @param entry
  • @return error
  • example

func (*LogHook) Levels

func (l *LogHook) Levels() []log.Level

Levels *

  • @Description:
  • @receiver l
  • @return []log.Level
  • example

func (*LogHook) SetFormat

func (l *LogHook) SetFormat(format log.Formatter)

SetFormat *

  • @Description:
  • @receiver l
  • @param format
  • example

Jump to

Keyboard shortcuts

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