gwtools

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: BSD-3-Clause Imports: 14 Imported by: 0

README

gwtools

介绍

一些公共函数、工具的集合

说明
  1. gwlog:日志功能,包含输出日志到cmd、文件、udp输出3个选择
  2. gwutils:一些函数
  3. xxxx

Documentation

Index

Constants

View Source
const (
	TimeYMD = "2006-01-02"
	TimeHMS = "15:04:05"
)

Variables

View Source
var (
	Local_path string
	Local_exe  string
	Local_sep  string
)

Functions

func GTime

func GTime() string

func GetFirst

func GetFirst(list []string) (str string)

func GetLast

func GetLast(list []string) (str string)

func GetVersion

func GetVersion() (ver string)

func Gfl

func Gfl() (fl string)

func LogE added in v1.0.6

func LogE(msg ...interface{})

func LogK

func LogK(kind string, msg ...interface{})

func LogSkip added in v1.0.6

func LogSkip(msg interface{}, kind string, skip int)

func NewByOption

func NewByOption(opts ...Option)

func PathExists

func PathExists(path string) (bool, error)

判断文件夹是否存在

func RandomString

func RandomString(n int, allowedChars ...[]rune) string

RandomString returns a random string with a fixed length

func RandomStringFake added in v1.0.5

func RandomStringFake(n int, allowedChars ...[]rune) string

Fake Random string

func Slice2String

func Slice2String(msg []interface{}) (str string)

func StartLog

func StartLog(log_type ...string)

初始化日志参数,并启动日志系统

func StopLog

func StopLog() bool

func TempLog

func TempLog(temp string)

func TestLog

func TestLog()

func TimeExitLog added in v1.0.4

func TimeExitLog(d time.Duration, msg string) (sigmsg os.Signal)

func TimeLog

func TimeLog(d time.Duration, msg string)

持续运行日志,必须使用协程运行

Types

type Gwlog

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

单条日志数据

func (*Gwlog) GetString

func (this *Gwlog) GetString() (str string)

type LogOption

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

用于option模式

type Option

type Option func(lo *LogOption)

func WithDivide added in v1.0.6

func WithDivide(divide string) Option

func WithPath

func WithPath(path string) Option

func WithUdp

func WithUdp(ip string, port int) Option

Jump to

Keyboard shortcuts

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