logviewer

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2018 License: MIT Imports: 18 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	LoadingText = "Loading ..."
	NoLogFiles  = "Available logs not found"
	ErrorText   = "Error"

	StatusRunningText = "Running"
	StatusStoppedText = ""
	RunningStyleName  = "status-running"
	StoppedStyleName  = "status-stopped"

	APIConnections = 4
	UpdateInterval = 500 * time.Millisecond
)
View Source
const (
	DefaultUpdateInterval = 200 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Coordinator

type Coordinator interface {
	// SetState sets status of the Coordinator to s.
	SetState(s UIState)
	// NotifyVMUpdated notifies that current ViewModel is updated.
	// Coordinator MUST replace views.
	NotifyVMUpdated()
}

Coordinator manages the navigation flow.

type ErrorMsg

type ErrorMsg struct {
	tui.Widget
	Err error
}

type FCDState

type FCDState int

FCDState is status of FuncLogDetailVM.

const (
	FCDLoading FCDState = iota
	FCDWait
)

type FuncLogDetailState

type FuncLogDetailState struct {
	State FCDState
	Error error

	Record types.FuncLog
	Mods   []types.GoModule
	Funcs  []types.GoFunc
	Lines  []types.GoLine
}

type FuncLogDetailStateMutable

type FuncLogDetailStateMutable FuncLogDetailState

type FuncLogDetailVM

type FuncLogDetailVM struct {
	Root   Coordinator
	Client restapi.ClientWithCtx
	LogID  string
	Record types.FuncLog
	// contains filtered or unexported fields
}

func (*FuncLogDetailVM) Update

func (vm *FuncLogDetailVM) Update(ctx context.Context)

func (*FuncLogDetailVM) UpdateInterval

func (vm *FuncLogDetailVM) UpdateInterval() time.Duration

func (*FuncLogDetailVM) View

func (vm *FuncLogDetailVM) View() View

type FuncLogDetailView

type FuncLogDetailView struct {
	VM *FuncLogDetailVM
	FuncLogDetailState
	// contains filtered or unexported fields
}

func (*FuncLogDetailView) FocusChain

func (v *FuncLogDetailView) FocusChain() tui.FocusChain

func (*FuncLogDetailView) Keybindings

func (v *FuncLogDetailView) Keybindings() map[string]func()

func (*FuncLogDetailView) Widget

func (v *FuncLogDetailView) Widget() tui.Widget

type GState

type GState int

GState is status of GraphVM

const (
	GLoading GState = iota
	GWait
)

type GraphCache

type GraphCache struct {
	LogInfo types.LogInfo
	Symbols *types.Symbols
	Records []types.FuncLog
	GMap    map[types.GID]types.Goroutine
	// contains filtered or unexported fields
}

func (*GraphCache) EndedFuncLogs

func (c *GraphCache) EndedFuncLogs(t types.Time) int

EndedFuncLogsは、時刻tの時点で実行が終了したFuncLogの数を返す。

func (*GraphCache) RunningFuncLogs

func (c *GraphCache) RunningFuncLogs(t types.Time) int

RunningFuncLogsは、時刻tの時点で実行中のFuncLogの数を返す。

func (*GraphCache) Update

func (c *GraphCache) Update(logID string, client restapi.ClientWithCtx) error

type GraphState

type GraphState struct {
	State    GState
	Error    error
	Lines    []Line
	Selected types.FuncLogID

	ScrollMode ScrollMode
	// X軸方向のスクロール量
	OffsetX int
	// Y軸方向のスクロール量
	OffsetY int

	ScrollSpeed image.Point
}

type GraphStateMutable

type GraphStateMutable struct {
	GraphState
}

func (*GraphStateMutable) UpdateOffset

func (s *GraphStateMutable) UpdateOffset(dx, dy int)

type GraphVM

type GraphVM struct {
	Root   Coordinator
	Client restapi.ClientWithCtx
	LogID  string
	// contains filtered or unexported fields
}

func (*GraphVM) Update

func (vm *GraphVM) Update(ctx context.Context)

func (*GraphVM) UpdateInterval

func (vm *GraphVM) UpdateInterval() time.Duration

func (*GraphVM) View

func (vm *GraphVM) View() View

type GraphView

type GraphView struct {
	VM *GraphVM
	GraphState
	// contains filtered or unexported fields
}

func (*GraphView) FocusChain

func (v *GraphView) FocusChain() tui.FocusChain

func (*GraphView) Keybindings

func (v *GraphView) Keybindings() map[string]func()

func (*GraphView) Widget

func (v *GraphView) Widget() tui.Widget

type GraphWidget

type GraphWidget struct {
	tui.WidgetBase
	// contains filtered or unexported fields
}

GraphWidget helps to painting the DAG (Directed Acyclic Graph).

func (*GraphWidget) AddLine

func (v *GraphWidget) AddLine(line Line)

func (*GraphWidget) Draw

func (v *GraphWidget) Draw(p *tui.Painter)

func (*GraphWidget) PartialDraw

func (v *GraphWidget) PartialDraw(p *tui.Painter, area1, area2 image.Point)

func (*GraphWidget) RemoveLines

func (v *GraphWidget) RemoveLines()

func (*GraphWidget) ScrollArea

func (v *GraphWidget) ScrollArea() image.Point

func (*GraphWidget) SetLines

func (v *GraphWidget) SetLines(lines []Line)

func (*GraphWidget) SetOrigin

func (v *GraphWidget) SetOrigin(origin Origin)

func (*GraphWidget) SizeHint

func (v *GraphWidget) SizeHint() image.Point

type LLState

type LLState int

LLState is status of LogListVM.

const (
	LLLoadingState LLState = iota
	LLWait
	LLSelectedState
)

type LRState

type LRState int

LRState is status of LogRecordVM.

const (
	LRLoadingState LRState = iota
	LRWait
	LRSelectedState
)

type Line

type Line struct {
	Start     image.Point
	Length    int
	Type      LineType
	StartDeco LineTermination
	EndDeco   LineTermination
	StyleName string
}

type LineTermination

type LineTermination int

LineTerminationは、線の終端の描画方法を指定する。 デフォルトは LineTerminationNormal である。

const (
	// 線の終端に"●"を描画する。
	// 線の長さが1なら、線の代わりに点だけが描画される。
	LineTerminationNormal LineTermination = iota
	// 線の終端に"◎"を描画する。
	// 線の長さが1なら、線の代わりに点だけが描画される。
	LineTerminationHighlight
	// 終端まで通常の縦棒 or 横棒が描画される。
	// 終端に点を描画しない。
	LineTerminationNone
)

func (LineTermination) Rune

func (p LineTermination) Rune(defaultRune rune) rune

type LineType

type LineType int

LineTypeは線を伸ばす方向(縦 or 横)を示す型である。 デフォルトは HorizontalLine である。

const (
	// 横線であることを示す。
	// 基準点からX軸方向に線を伸ばす。
	HorizontalLine LineType = iota
	// 縦線であることを示す。
	// 基準点からY軸方向に線を伸ばす。
	VerticalLine
)

func (LineType) Rune

func (l LineType) Rune() rune

type LogListState

type LogListState struct {
	State      LLState
	Error      error
	Logs       []types.LogInfo
	SelectedID string
}

type LogListStateMutable

type LogListStateMutable LogListState

type LogListVM

type LogListVM struct {
	Root   Coordinator
	Client restapi.ClientWithCtx
	// contains filtered or unexported fields
}

LogListVM implements ViewModel.

func (*LogListVM) SelectedLog

func (vm *LogListVM) SelectedLog() string

func (*LogListVM) Update

func (vm *LogListVM) Update(ctx context.Context)

func (*LogListVM) UpdateInterval

func (vm *LogListVM) UpdateInterval() time.Duration

func (*LogListVM) View

func (vm *LogListVM) View() View

type LogListView

type LogListView struct {
	VM *LogListVM
	LogListState
	// contains filtered or unexported fields
}

LogListView implements View

func (*LogListView) FocusChain

func (v *LogListView) FocusChain() tui.FocusChain

func (*LogListView) Keybindings

func (v *LogListView) Keybindings() map[string]func()

func (*LogListView) Widget

func (v *LogListView) Widget() tui.Widget

type LogRecordState

type LogRecordState struct {
	State      LRState
	Error      error
	Records    []types.FuncLog
	SelectedID types.FuncLogID
	Symbols    *types.Symbols
}

type LogRecordStateMutable

type LogRecordStateMutable LogRecordState

type LogRecordVM

type LogRecordVM struct {
	Root   Coordinator
	Client restapi.ClientWithCtx
	LogID  string
	// contains filtered or unexported fields
}

func (*LogRecordVM) Update

func (vm *LogRecordVM) Update(ctx context.Context)

func (*LogRecordVM) UpdateInterval

func (vm *LogRecordVM) UpdateInterval() time.Duration

func (*LogRecordVM) View

func (vm *LogRecordVM) View() View

type LogRecordView

type LogRecordView struct {
	VM *LogRecordVM
	LogRecordState
	// contains filtered or unexported fields
}

func (*LogRecordView) FocusChain

func (v *LogRecordView) FocusChain() tui.FocusChain

func (*LogRecordView) Keybindings

func (v *LogRecordView) Keybindings() map[string]func()

func (*LogRecordView) Widget

func (v *LogRecordView) Widget() tui.Widget

type Origin

type Origin int

原点座標を tui.Surface 上のどこに配置するか指定する。 デフォルトは OriginTopLeft である。

const (
	// 原点は左上に配置する。
	//   0────→ X
	//   │....
	//   │....
	//   ↓
	//   Y
	OriginTopLeft Origin = iota
	// 原点を右上に配置する。
	// X軸の方向が反対にになることに注意。
	//   X ←────0
	//      ....│
	//      ....│
	//          ↓
	//          Y
	OriginTopRight
	// 原点を左下に配置する。通常の数学のグラフと同じ配置である。
	//   Y
	//   ⇡
	//   │....
	//   │....
	//   0────→ X
	OriginBottomLeft
	// 原点を右下に配置する。
	//          Y
	//          ⇡
	//      ....│
	//      ....│
	//   X ←────0
	OriginBottomRight
)

type ScrollMode

type ScrollMode int
const (
	ManualScrollMode ScrollMode = iota
	AutoScrollMode
)

type ScrollWidget

type ScrollWidget struct {
	ScrollableWidget
	// contains filtered or unexported fields
}

func (*ScrollWidget) AutoScroll

func (w *ScrollWidget) AutoScroll(x, y bool)

func (*ScrollWidget) Draw

func (w *ScrollWidget) Draw(p *tui.Painter)

func (*ScrollWidget) Scroll

func (w *ScrollWidget) Scroll(x, y int)

type ScrollableWidget

type ScrollableWidget interface {
	tui.Widget
	ScrollArea() image.Point
	PartialDraw(p *tui.Painter, area1, area2 image.Point)
}

type UICoordinator

type UICoordinator struct {
	Config *config.Config
	Api    *restapi.Client
	LogID  string
	UI     tui.UI
	// contains filtered or unexported fields
}

UICoordinator implements of Coordinator.

func (*UICoordinator) NotifyVMUpdated

func (c *UICoordinator) NotifyVMUpdated()

func (*UICoordinator) Quit

func (c *UICoordinator) Quit()

func (*UICoordinator) Run

func (c *UICoordinator) Run() error

func (*UICoordinator) SetState

func (c *UICoordinator) SetState(s UIState)

type UIState

type UIState struct {
	LogID        string
	RecordID     types.FuncLogID
	Record       types.FuncLog
	UseGraphView bool
}

UIState is status of Coordinator.

type Updatable

type Updatable interface {
	// Update()を呼び出す頻度。
	// 負の値を返した場合、Update()は初回のみ呼び出され、それ以降の自動更新は行わない。
	// 0を返した場合、DefaultUpdateIntervalの頻度でUpdate()を呼び出す。
	// 正の値を返した場合、指定した頻度でUpdate()を呼び出す。
	UpdateInterval() time.Duration
	// Update()は、キャッシュのアップデートを行う。
	// 完了するまで長時間ブロックする可能性がある。
	// ctxはnon-nilでなければならない。
	Update(ctx context.Context)
}

type Updater

type Updater struct{}

func (Updater) Run

func (u Updater) Run(ctx context.Context, target Updatable)

type View

type View interface {
	// Widget creates widgets, and returns a parent widget.
	Widget() tui.Widget
	// Keybindings returns map of key-sequences and handlers.
	// If we do not necessarily set keybindings, it will return nil or empty map.
	Keybindings() map[string]func()
	// FocusChain returns tui.FocusChain.
	// You MUST call the View.Widget() before call this method.
	FocusChain() tui.FocusChain
}

View interface creates widgets to build the user interface, and notify user inputs to ViewModel interface.

type ViewModel

type ViewModel interface {
	Updatable
	// View builds View object from cache.
	View() View
}

ViewModel interface implements the business logic.

Jump to

Keyboard shortcuts

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