Help us shape the future of Go! Take the 2026 Go Developer Survey

output

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 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    []StageOutput
	Lines     []string
}

func ParseLogFile

func ParseLogFile(filename string) (Log, error)

ParseLogFile 解析日志文件,返回存储了 Stage 输出的列表

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)

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

func (*Output) StageDuration

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

StageDuration 返回某个 Stage 的持续时间

func (*Output) StageOutputList

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

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

func (*Output) StageTimeConsuming

func (o *Output) StageTimeConsuming(name string) (TimeConsuming, error)

StageTimeConsuming 将阶段的时间信息暴露出去,便于外部查看详情

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 将一行普通内容写入输出

type StageOutput

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

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