wsTaskInfo

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Info    = 1
	Warning = 2
	Success = 3
	Error   = 4
)
View Source
const MaxErrorNum = 10

MaxErrorNum 最大存储数据数量,配合limitNum使用

Variables

This section is empty.

Functions

func CreateTaskHandler

func CreateTaskHandler(path string, wsTask WsTask) http.Handler

Types

type Message

type Message struct {
	Id int
}

type Sprint

type Sprint struct {
	Clear bool   `json:"clear"`
	Text  string `json:"text"`
	Time  string `json:"time"`
	Level int    `json:"level"`
}

type Sprintf

type Sprintf struct {
	Sprints []*Sprint

	MinUpdatePause time.Duration

	io.Writer
	// contains filtered or unexported fields
}

func NewSprintf

func NewSprintf(task WsTaskInfo) *Sprintf

func (*Sprintf) Append

func (sf *Sprintf) Append(level int, str string)

func (*Sprintf) AppendByForce

func (sf *Sprintf) AppendByForce(level int, str string, force bool)

func (*Sprintf) AppendForClear

func (sf *Sprintf) AppendForClear(level int, str string, save bool)

func (*Sprintf) AppendLimit

func (sf *Sprintf) AppendLimit(level int, str string)

func (*Sprintf) ResetLimitNum

func (sf *Sprintf) ResetLimitNum()

ResetLimitNum 重置日志最大条数限制

func (*Sprintf) SendAllLog

func (sf *Sprintf) SendAllLog()

func (*Sprintf) SetMinUpdatePause

func (sf *Sprintf) SetMinUpdatePause(d time.Duration)

func (*Sprintf) UpdateTaskInfo

func (sf *Sprintf) UpdateTaskInfo(task WsTaskInfo)

func (*Sprintf) Write

func (sf *Sprintf) Write(p []byte) (n int, err error)

type WsTask

type WsTask interface {
	Get(id int) WsTaskInfo
	Set(id int, task WsTaskInfo)
	Close(id int, reason string, status uint32)
	GetCount() int
}

type WsTaskInfo

type WsTaskInfo interface {
	GetId() int
	SetId(id int)
	SetBound(c chan string)
	GetBound() chan string
	CloseBound()
	IntoBound(msg string)
	SetSockJSSession(sockjs.Session)
	SendMsg(msg interface{})
	CloseSockJSSession(reason string, status uint32)
}

Jump to

Keyboard shortcuts

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