themecfg

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package themecfg defines configuration file format for a logftxt theme.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatting

type Formatting struct {
	Timestamp formatting.Item  `yaml:"timestamp"`
	Level     formatting.Level `yaml:"level"`
	Logger    formatting.Item  `yaml:"logger"`
	Message   formatting.Item  `yaml:"message"`
	Field     formatting.Item  `yaml:"field"`
	Key       formatting.Item  `yaml:"key"`
	Caller    formatting.Item  `yaml:"caller"`
	Types     FormattingTypes  `yaml:"types"`
}

Formatting is a formatting configuration section.

type FormattingTypes

type FormattingTypes struct {
	Array    formatting.Item `yaml:"array"`
	Object   formatting.Item `yaml:"object"`
	String   formatting.Item `yaml:"string"`
	Quotes   Style           `yaml:"quotes"`
	Special  Style           `yaml:"special"`
	Number   formatting.Item `yaml:"number"`
	Boolean  formatting.Item `yaml:"boolean"`
	Time     formatting.Item `yaml:"time"`
	Duration formatting.Item `yaml:"duration"`
	Null     formatting.Item `yaml:"null"`
	Error    formatting.Item `yaml:"error"`
}

FormattingTypes is a formatting.types configuration section.

type Item

type Item string

Item defines and item that can go as part of log message output.

const (
	ItemTimestamp Item = "timestamp"
	ItemLevel     Item = "level"
	ItemLogger    Item = "logger"
	ItemMessage   Item = "message"
	ItemFields    Item = "fields"
	ItemCaller    Item = "caller"
)

Valid values for Item.

func (Item) Validate

func (i Item) Validate() error

Validate checks if i has a valid value.

type Settings added in v0.6.0

type Settings struct {
	TimeFormat string `yaml:"time-format"`
}

Settings is a settings configuration section.

type Style

type Style = formatting.Style

Style includes background color, foreground color and a set of modes. Modes overwrites current set of modes during style rendering. So, explicitly specifying empty list of modes will disable all currently enabled modes.

type Theme

type Theme struct {
	Version    string     `yaml:"version"`
	Items      []Item     `yaml:"items"`
	Settings   Settings   `yaml:"settings"`
	Formatting Formatting `yaml:"formatting"`
}

Theme contains theme configuration that can be described in a YAML file.

func Load

func Load(reader io.Reader) (*Theme, error)

Load loads Theme from the given reader.

func (*Theme) Validate

func (t *Theme) Validate() error

Validate check that t is valid.

Directories

Path Synopsis
Package formatting provides formatting configuration section for slogtxt theme configuration.
Package formatting provides formatting configuration section for slogtxt theme configuration.

Jump to

Keyboard shortcuts

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