ui

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SET_FILTER_KEY    = '/'
	TOGGLE_FILTER_KEY = 'f'
	SET_PATTERN_KEY   = 'p'
	HELP_KEY          = 'h'
)

Key bindings

View Source
const (
	MAIN_PAGE_NAME  = "main"
	HELP_PAGE_NAME  = "helpModal"
	ERROR_PAGE_NAME = "errorModal"
)

Pages names

View Source
const (
	NON_PATTERN_MATCHING_LINES_FORMAT = "[crimson:-:-]"

	STATUS_BAR_BACKGROUND_COLOR = tcell.ColorGray

	NON_PATTERN_LINES_STATUS_BACKGROUND_COLOR = tcell.ColorDarkRed
	NON_PATTERN_LINES_STATUS_TEXT_COLOR       = tcell.ColorLightGray

	FILTER_STATUS_NONACTIVE_BACKGROUND_COLOR = tcell.ColorGray
	FILTER_STATUS_ACTIVE_BACKGROUND_COLOR    = tcell.ColorLimeGreen
	FILTER_STATUS_TEXT_COLOR                 = tcell.ColorLightGray

	INPUT_NAME_BACKGROUND_COLOR = tcell.ColorDarkSlateGray
	INPUT_NAME_TEXT_COLOR       = tcell.ColorLightGray

	FOLLOWING_STATUS_TEXT_COLOR                 = tcell.ColorLightGray
	FOLLOWING_STATUS_ACTIVE_BACKGROUND_COLOR    = tcell.ColorNavy
	FOLLOWING_STATUS_NONACTIVE_BACKGROUND_COLOR = tcell.ColorGray
)

Color theme

Variables

View Source
var HelpFilterText = `` /* 1215-byte string literal not displayed */
View Source
var HelpHomeText = format.Sprintf(`
Status bar on top displays several helpful information. Describing from left to right:
 - Input name
 - Optional "F" indicator that shows if loggy is following the end of the logs
 - Filter status that displays "<number of filter matching lines>/<number of total lines>". If it has green background than filter is applied otherwise is turned off or not set.
 - Optional number of lines that were not possible to match against the parsing pattern.s

Main key shortcuts:
 - "%<filter>s" for setting filter
 - "%<toggleFilter>s" for toggling filter
 - "%<pattern>s" for setting parsing pattern input
 - "%<help>s" for displaying help`, KEY_MAP)
View Source
var HelpInputsText = `` /* 548-byte string literal not displayed */
View Source
var HelpNavigationText = `` /* 283-byte string literal not displayed */
View Source
var HelpParsingPatternText = fmt.Sprintf(`The logs are parsed using parsing pattern that you have to configure in order to use filters. The lines are tokenized using space character. Internally regex is used for parsing, but the input pattern is escaped by default for special characters so you don't have to worry about special characters. You define parameters using syntax "<name:type>", where name is the name of parameter that you can refer to in filters and type is predefined type used to correctly find and parse the parameter.

Lines that were not possible to parsed are colored with red color. Moreover counter of how many lines were not possible to parse is displayed in the status bar on the right end of it. It is only present if there are some lines that were not possible to parse.  

There is built-in bool parameter called "%s" reserved for marking log lines that were or were not possible to match against the parsing pattern. So you can use that to debug your parsing pattern with expressions like "!%[1]s"

Supported types:
 - "string" defines string containing non-whitespace characters: [^\s]+
 - "integer" defines a integer: [0-9]+
 - "rest" collects the rest of the line: .*

Example log and bellow its parsing pattern:
[2022-09-11T15:04:22](authorization) DEBUG 200 We have received login information
[<timestamp:string>](<component:string>) <level:string> <code:integer> <message:rest>`, store.PATTERN_MATCHING_PARAMETER_NAME)
View Source
var KEY_MAP = map[string]interface{}{
	"filter":       string(SET_FILTER_KEY),
	"pattern":      string(SET_PATTERN_KEY),
	"toggleFilter": string(TOGGLE_FILTER_KEY),
	"help":         string(HELP_KEY),
	"version":      Version,
}
View Source
var Version string = ""

Version string set in release time

Functions

func Bootstrap

func Bootstrap(stateStore *gredux.Store, bufferSize int) (*tview.Application, error)

Bootstrap setup the tview App and bootstraps all its components It returns also io.Writer that is used to pass logs into the LogsView

Types

This section is empty.

Jump to

Keyboard shortcuts

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