util

package
v0.0.0-...-de7ae53 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LevelError 错误
	LevelError = iota
	// LevelWarning 警告
	LevelWarning
	// LevelInformational 提示
	LevelInformational
	// LevelDebug 除错
	LevelDebug
)

Variables

This section is empty.

Functions

func AssertErrorToNil

func AssertErrorToNil(message string, err error)

AssertErrorToNil common assert err judge err is nil or not

func BuildLogger

func BuildLogger(loggerName string, level string)

BuildLogger 构建logger

func ConvertCookieStrToPlaywrightCookieList

func ConvertCookieStrToPlaywrightCookieList(cookieStr string, domain *string) []playwright.OptionalCookie

ConvertCookieStrToPlaywrightCookieList convert str cookie to playwright cookie structs

func GetBoolFromEnv

func GetBoolFromEnv(key string) (bool, error)

GetBoolFromEnv convert a bool string to type bool

func GetUserAgent

func GetUserAgent() string

GetUserAgent get random user agent

func MergeMap

func MergeMap(m map[string]interface{}, overriddenMap map[string]interface{}) map[string]interface{}

MergeMap Merge two map, the first map have higher priority

func OpenImage

func OpenImage(absImageFilePath string) error

OpenImage given an image with an absolute path, call the system command to open it

func ShowQrcode

func ShowQrcode(base64Image string) error

ShowQrcode show qrcode

Types

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger 日志

func Log

func Log() *Logger

Log 返回日志对象

func (*Logger) Debug

func (ll *Logger) Debug(format string, v ...any)

Debug 校验

func (*Logger) Error

func (ll *Logger) Error(format string, v ...any)

Error 错误

func (*Logger) Info

func (ll *Logger) Info(format string, v ...any)

Info 信息

func (*Logger) Panic

func (ll *Logger) Panic(format string, v ...any)

Panic 极端错误

func (*Logger) Println

func (ll *Logger) Println(msg string)

Println 打印

func (*Logger) Warning

func (ll *Logger) Warning(format string, v ...any)

Warning 警告

Jump to

Keyboard shortcuts

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