log

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const EndFlag = "-[EOF]-"

Variables

This section is empty.

Functions

func IsEnd

func IsEnd(line string) bool

Types

type HostLogger

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

func NewHostLogger

func NewHostLogger(file *os.File) *HostLogger

func (*HostLogger) Append

func (s *HostLogger) Append(lineContent string)

func (*HostLogger) Close

func (s *HostLogger) Close()

func (*HostLogger) GetName

func (s *HostLogger) GetName() string

func (*HostLogger) GetReader

func (s *HostLogger) GetReader() *bufio.Reader

func (*HostLogger) Original

func (s *HostLogger) Original() *os.File

func (*HostLogger) WriteEnd

func (s *HostLogger) WriteEnd()

type Manager

type Manager struct {
	dvservice.WorkDirService
	LocateDir string // workdir下的相对路径
}

func NewManager

func NewManager(locateDir string) *Manager

func (*Manager) CreateHostLogger

func (s *Manager) CreateHostLogger(taskId int64, host string) (*HostLogger, error)

func (*Manager) CreateManifestLogger

func (s *Manager) CreateManifestLogger(taskId int64) (*ManifestLogger, error)

func (*Manager) OpenHostLogger

func (s *Manager) OpenHostLogger(taskId int64, host string, hostLogName string) (*HostLogger, error)

func (*Manager) OpenLatestManifestLogger

func (s *Manager) OpenLatestManifestLogger(taskId int64) (*ManifestLogger, error)

func (*Manager) RemoveLogs

func (s *Manager) RemoveLogs(taskId int64)

func (*Manager) RemoveOldLogs

func (s *Manager) RemoveOldLogs(taskId int64, remainHistoryCount int)

RemoveOldLogs 保留最近的remainHistoryCount次日志,会清除较老的日志

type ManifestEntry

type ManifestEntry struct {
	Index       int    `json:"index"`       // 序号
	Time        string `json:"time"`        // 时间
	Host        string `json:"host"`        // 主机地址(IP)
	HostLogName string `json:"hostLogName"` // 主机日志名称
	Status      string `json:"status"`      // 执行状态,成功、失败等
}

func NewEntry

func NewEntry(index int, host, hostLogFileName, status string) *ManifestEntry

func ParseEntry

func ParseEntry(entryLine string) (*ManifestEntry, error)

func (*ManifestEntry) FormatString

func (s *ManifestEntry) FormatString() string

type ManifestLogger

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

func NewManifestLogger

func NewManifestLogger(file *os.File) *ManifestLogger

func (*ManifestLogger) Append

func (s *ManifestLogger) Append(entry *ManifestEntry)

func (*ManifestLogger) Close

func (s *ManifestLogger) Close()

func (*ManifestLogger) GetReader

func (s *ManifestLogger) GetReader() *bufio.Reader

func (*ManifestLogger) Original

func (s *ManifestLogger) Original() *os.File

func (*ManifestLogger) WriteEnd

func (s *ManifestLogger) WriteEnd()

Jump to

Keyboard shortcuts

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