output

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadFileLines

func ReadFileLines(filename string) ([]string, error)

ReadFileLines 读取文件中的行

Types

type Log

type Log struct {
	StartTime time.Time
	EndTime   time.Time
	Duration  time.Duration
	Stages    []Stage
	Lines     []string
}

func ParseLogFile

func ParseLogFile(filename string) (Log, error)

ParseLogFile 解析日志文件,返回 Log 对象

type Output

type Output struct {
	Name string
	ID   int
	// contains filtered or unexported fields
}

func New

func New(name string, id int) *Output

New 新建一个 Output 对象,会自动初始化文件,以及定时将内容写入文件

func (*Output) Content

func (o *Output) Content() string

Content 总是返回从起始到现在的所有内容

func (*Output) Done

func (o *Output) Done()

Done 标记输出已完成,会将缓存中的内容刷入文件,然后关闭文件

func (*Output) Duration

func (o *Output) Duration() time.Duration

Duration 返回持续时间

func (*Output) Filename

func (o *Output) Filename() string

Filename 返回文件名

func (*Output) NewContent

func (o *Output) NewContent() string

NewContent 总是返回自上次读取后新出现的内容

func (*Output) NewStage

func (o *Output) NewStage(name string)

NewStage 会写入以 [Pipeline] Stage: 开头的一行,表示一个新的 Stage 开始

func (*Output) NewStep

func (o *Output) NewStep(name string)

NewStep 会写入以 [Pipeline] Step: 开头的一行,表示一个新的 Step 开始

func (*Output) StageDuration

func (o *Output) StageDuration(name string) time.Duration

StageDuration 返回某个 Stage 的持续时间

func (*Output) StageOutputList

func (o *Output) StageOutputList() []Stage

StageOutputList 返回存储了 Stage 输出的列表

func (*Output) TimeConsuming

func (o *Output) TimeConsuming() TimeConsuming

TimeConsuming 返回耗时信息

func (*Output) WriteCommandLine

func (o *Output) WriteCommandLine(line string)

WriteCommandLine 将一行命令行内容写入输出,其实就是在前面加上了一个 "> "

func (*Output) WriteLine

func (o *Output) WriteLine(line string)

WriteLine 将一行普通内容写入输出

func (*Output) WriteLineWithNoTime added in v1.0.3

func (o *Output) WriteLineWithNoTime(line string)

type Stage added in v1.0.3

type Stage struct {
	StartTime time.Time
	EndTime   time.Time
	Duration  time.Duration
	Name      string
	Lines     []string
}

type Step added in v1.0.3

type Step struct {
	Name string `json:"name"`

	Content string `json:"content"`
	// contains filtered or unexported fields
}

func ParseStageSteps added in v1.0.3

func ParseStageSteps(stage *Stage) []*Step

ParseStageSteps 解析一个 stage 中的 step

type TimeConsuming

type TimeConsuming struct {
	Done      bool
	StartTime time.Time
	EndTime   time.Time
	Duration  time.Duration
}

Jump to

Keyboard shortcuts

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