Documentation
¶
Index ¶
- Variables
- func Execute(context context.Context) error
- func GetPager(context context.Context) (output io.WriteCloser, close func(), err error)
- func ParseLocation(location string) (*time.Location, error)
- func ReadLine(reader io.Reader) (line []byte, err error)
- type AllLogFilter
- type AndNode
- type BooleanNode
- type ConditionLogFilter
- type ConditionNode
- type ConstantNode
- type EqualsNode
- type FieldNode
- type LeafNode
- type LevelLogFilter
- type LogEntry
- type LogFilter
- type LogLevel
- type MatchNode
- type MultiLogFilter
- type NotNode
- type NumberNode
- type OrNode
- type OutputOptions
- type RegexNode
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Gray = "\033[90m" Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" Magenta = "\033[35m" Cyan = "\033[36m" White = "\033[37m" Reset = "\033[0m" )
View Source
var CmdOptions struct { OutputOptions Completion *flags.EnumFlag ConfigFile string LogDestination string Timezone string UsePager bool Verbose bool Debug bool }
CmdOptions contains the global options
View Source
var LevelColors = map[int]string{ 0: Blue, 10: Gray, 20: Yellow, 30: Green, 40: Magenta, 50: Red, 60: Red, }
View Source
var RootCmd = &cobra.Command{
Short: "pretty-print logviewer logs from stdin or file(s)",
Long: "logviewer is a simple and fast JSON log viewer. It reads log entries from given files or stdin and pretty-prints them to stdout.",
RunE: runRootCommand,
}
RootCmd represents the base command when called without any subcommands
View Source
var TimezoneAbbreviations = map[string]int{}/* 201 elements not displayed */
Functions ¶
Types ¶
type AllLogFilter ¶
type AllLogFilter struct{}
type AndNode ¶
type AndNode struct { Left ConditionNode Right ConditionNode }
type BooleanNode ¶
type BooleanNode struct {
Value bool
}
func (BooleanNode) GetValue ¶
func (node BooleanNode) GetValue(entry LogEntry) string
func (BooleanNode) String ¶
func (node BooleanNode) String() string
type ConditionLogFilter ¶
type ConditionLogFilter struct {
Condition ConditionNode
}
func NewConditionFilter ¶
func NewConditionFilter(condition string) (*ConditionLogFilter, error)
type ConditionNode ¶
func ParseCondition ¶
func ParseCondition(condition string) (ConditionNode, error)
type ConstantNode ¶
type ConstantNode struct {
Value string
}
func (ConstantNode) GetValue ¶
func (node ConstantNode) GetValue(entry LogEntry) string
func (ConstantNode) String ¶
func (node ConstantNode) String() string
type EqualsNode ¶
func CreateEqualNode ¶
func CreateEqualNode(left, right string) EqualsNode
func (EqualsNode) Evaluate ¶
func (node EqualsNode) Evaluate(entry LogEntry) bool
type LeafNode ¶
func ParseLeafNode ¶
type LevelLogFilter ¶
type LevelLogFilter struct {
LevelSet logger.LevelSet
}
func NewLevelLogFilter ¶
func NewLevelLogFilter(level string) *LevelLogFilter
type LogEntry ¶
type LogEntry struct { Time time.Time `json:"time"` Level LogLevel `json:"level"` Hostname string `json:"hostname"` Name string `json:"name"` PID int64 `json:"pid"` TaskID int64 `json:"tid"` Topic string `json:"topic"` Scope string `json:"scope"` Message string `json:"msg"` Fields map[string]any Blobs map[string]any }
LogEntry represents a log entry
func (*LogEntry) UnmarshalJSON ¶
UnmarshalJSON unmarshal data into this
type MatchNode ¶
func CreateMatchNode ¶
type MultiLogFilter ¶
type MultiLogFilter struct {
Filters []LogFilter
}
func (*MultiLogFilter) Add ¶
func (filter *MultiLogFilter) Add(filters ...LogFilter) *MultiLogFilter
func (MultiLogFilter) AsFilter ¶
func (filter MultiLogFilter) AsFilter() LogFilter
func (MultiLogFilter) Filter ¶
func (filter MultiLogFilter) Filter(context context.Context, entry LogEntry) bool
func (MultiLogFilter) IsEmpty ¶
func (filter MultiLogFilter) IsEmpty() bool
type NotNode ¶
type NotNode struct {
Node ConditionNode
}
type NumberNode ¶
type NumberNode struct {
Value float64
}
func (NumberNode) GetValue ¶
func (node NumberNode) GetValue(entry LogEntry) string
func (NumberNode) String ¶
func (node NumberNode) String() string
type OrNode ¶
type OrNode struct { Left ConditionNode Right ConditionNode }
type OutputOptions ¶
Source Files
¶
- colors.go
- completion.go
- condition_mode_or.go
- condition_node.go
- condition_node_and.go
- condition_node_equal.go
- condition_node_match.go
- condition_node_not.go
- leaf_node.go
- leaf_node_boolean.go
- leaf_node_constant.go
- leaf_node_field.go
- leaf_node_number.go
- leaf_node_regex.go
- location.go
- log_entry.go
- log_filter.go
- log_filter_condition.go
- log_filter_level.go
- log_filter_multi.go
- log_level.go
- root.go
- tools.go
Click to show internal directories.
Click to hide internal directories.