gwtools

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: May 20, 2022 License: BSD-3-Clause Imports: 13 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 LogK

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

func LogM

func LogM(msg ...interface{})

func New

func New(log_type, log_path, log_ip string, log_port int)

func NewByOption

func NewByOption(log_type string, opts ...Option)

func NewLog

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

func PathExists

func PathExists(path string) (bool, error)

判断文件夹是否存在

func ProcessId

func ProcessId() (pid []int32)

获取所有进程id,以数组返回

func ProcessName

func ProcessName() (pname []string)

获取所有进程名,以数组返回

func ProcessNameExe

func ProcessNameExe() (mname map[string]*process.Process)

获取所有进程,以map返回

func RandomString

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

RandomString returns a random string with a fixed length

func Slice2String

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

func StartLog

func StartLog()

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

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 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