Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Dark are the default styles, suitable for the dark shell // backgrounds. Dark = DefaultThemeStyles{ Trace: DefaultThemeLevel{First: `{fg 243}`}, Debug: DefaultThemeLevel{First: `{fg 250}`}, Info: DefaultThemeLevel{First: `{fg 110}`}, Warning: DefaultThemeLevel{First: `{fg 178}`}, Error: DefaultThemeLevel{ Level: `{bold}{bg 52}`, }, Fatal: DefaultThemeLevel{First: `{bold}{fg 197}{bg 17}`}, } // Light are the default styles, suitable for the light shell // backgrounds. Light = DefaultThemeStyles{ Trace: DefaultThemeLevel{First: `{fg 250}`}, Debug: DefaultThemeLevel{First: `{fg 243}`}, Info: DefaultThemeLevel{First: `{fg 26}`}, Warning: DefaultThemeLevel{First: `{fg 167}{bg 230}`}, Error: DefaultThemeLevel{ Level: `{reverse}{bold}{bg 231}`, }, Fatal: DefaultThemeLevel{First: `{bold}{fg 231}{bg 124}`}, } // Default are the default styles, suitable for the both // light and dark shell backgrounds. Default = DefaultThemeStyles{ Trace: DefaultThemeLevel{First: `{nofg}`}, Debug: DefaultThemeLevel{First: `{fg 31}`}, Info: DefaultThemeLevel{First: `{fg 33}`}, Warning: DefaultThemeLevel{ Level: `{bold}{fg 231}{bg 178}`, }, Error: DefaultThemeLevel{ Level: `{bold}{fg 231}{bg 202}`, }, Fatal: DefaultThemeLevel{ Level: `{bold}{fg 231}{bg 196}`, }, } )
Functions ¶
func Format ¶
Format parses specified formatting (loreley based) and return lorg.Formatter.
Following functions are available:
- {bg <color>}, {fg <color>}, {nobg}, {nofg}, {bold}, {nobold}, {reverse}, {noreverse}, {reset}, {from <text> <bg>}, {to <bg> <text>}.
- {onlevel <level> <style>} - match given level and insert given style.
- {ontrace <style>} - alias for {onlevel "trace" <style>}.
- {ondebug <style>} - alias for {onlevel "debug" <style>}.
- {oninfo <style>} - alias for {onlevel "info" <style>}.
- {onwarning <style>} - alias for {onlevel "warning" <style>}.
- {onerror <style>} - alias for {onlevel "error" <style>}.
- {onfatal <style>} - alias for {onlevel "fatal" <style>}.
- {store} - store all previous style
- {restore} - restore previous style, saved by {store}.
Types ¶
type DefaultOutput ¶
func (*DefaultOutput) WriteWithLevel ¶
type DefaultThemeLevel ¶
type DefaultThemeLevel struct { // First describes style for first line. First string // Trail describes style for all other lines. Trail string // Level describes style for level substring. Level string }
DefaultThemeLevel describes how to highlight given level.
type DefaultThemeStyles ¶
type DefaultThemeStyles struct { // Trace specifies overall style for trace logs level Trace DefaultThemeLevel // Debug specifies overall style for debug logs level Debug DefaultThemeLevel // Info specifies overall style for info logs level Info DefaultThemeLevel // Warning specifies overall style for warning log level Warning DefaultThemeLevel // Error specifies overall style for error log level Error DefaultThemeLevel // Fatal specifies overall style for fatal log level Fatal DefaultThemeLevel }
DefaultThemeStyles represents template values for default Light and Dark themes.
type Theme ¶
type Theme struct { lorg.Formatter lorg.SmartOutput }
func ApplyDefaultTheme ¶
func ApplyDefaultTheme( formatting string, styles DefaultThemeStyles, ) (*Theme, error)
ApplyDefaultTheme applies default theme to the given lorg formatting string.
`styles` can be used to specify color scheme for the default theme.
func MustApplyDefaultTheme ¶
func MustApplyDefaultTheme( formatting string, styles DefaultThemeStyles, ) *Theme
MustApplyDefaultTheme is the same, as ApplyDefaultTheme, but panics on error.
Click to show internal directories.
Click to hide internal directories.