Documentation ¶
Index ¶
- Variables
- func Mark(str string, matcherFunc MatcherFunc, c *color.Color) string
- func MarkMany(str string, c *color.Color, matcherFuncs ...MatcherFunc) string
- type MarkBuilder
- type MarkRule
- type Match
- type MatcherFunc
- func MatchAll(pattern string) MatcherFunc
- func MatchBracketSurrounded() MatcherFunc
- func MatchDaysOfWeek() MatcherFunc
- func MatchEmail() MatcherFunc
- func MatchMultiple(patternsToMatch []string) MatcherFunc
- func MatchN(pattern string, n int) MatcherFunc
- func MatchParensSurrounded() MatcherFunc
- func MatchRegexp(r *regexp.Regexp) MatcherFunc
- func MatchSurrounded(opening string, closure string) MatcherFunc
- func MatchTimestamp(layout string) MatcherFunc
- type WriteMarker
- type WriteMarkerOption
Constants ¶
This section is empty.
Variables ¶
var ( ANSICRegexp = regexp.MustCompile(fmt.Sprintf("%s %s %s %s %s", weekdaysAbv, monthsAbv, days, hhmmss, year)) UnixDateRegexp = regexp.MustCompile(fmt.Sprintf("%s %s %s %s %s %s", weekdaysAbv, monthsAbv, days, hhmmss, timezone, year)) RubyDateRegexp = regexp.MustCompile(fmt.Sprintf("%s %s %s %s %s %s", weekdaysAbv, monthsAbv, daysWithZero, hhmmss, numericZone, year)) RFC822Regexp = regexp.MustCompile(fmt.Sprintf("%s %s [0-9]{2} %s %s", daysWithZero, monthsAbv, hhmm, timezone)) RFC822ZRegexp = regexp.MustCompile(fmt.Sprintf("%s %s [0-9]{2} %s %s", daysWithZero, monthsAbv, hhmm, numericZone)) RFC850Regexp = regexp.MustCompile(fmt.Sprintf("%s, %s-%s-[0-9]{2} %s %s", weekdays, daysWithZero, monthsAbv, hhmmss, timezone)) RFC1123Regexp = regexp.MustCompile(fmt.Sprintf("%s, %s %s %s %s %s", weekdaysAbv, daysWithZero, monthsAbv, year, hhmmss, timezone)) RFC1123ZRegexp = regexp.MustCompile(fmt.Sprintf("%s, %s %s %s %s %s", weekdaysAbv, daysWithZero, monthsAbv, year, hhmmss, numericZone)) RFC3339Regexp = regexp.MustCompile(fmt.Sprintf("%s-%s-%sT%sZ%s", year, numericmonths, daysWithZero, hhmmss, hhmm)) RFC3339NanoRegexp = regexp.MustCompile(fmt.Sprintf("%s-%s-%sT%s%sZ%s", year, numericmonths, daysWithZero, hhmmss, nano, hhmm)) KitchenRegexp = regexp.MustCompile("(([0-1]?[0-9]|2[0-3]):[0-5][0-9][P|A]M)") StampRegexp = regexp.MustCompile(fmt.Sprintf("%s %s %s(\\s|$)", monthsAbv, days, hhmmss)) StampMilliRegexp = regexp.MustCompile(fmt.Sprintf("%s %s %s%s", monthsAbv, days, hhmmss, milli)) StampMicroRegexp = regexp.MustCompile(fmt.Sprintf("%s %s %s%s", monthsAbv, days, hhmmss, micro)) StampNanoRegexp = regexp.MustCompile(fmt.Sprintf("%s %s %s%s", monthsAbv, days, hhmmss, nano)) )
var EmailRegexp = regexp.MustCompile(`[a-z0-9!#$%&'*+/=?^_{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])`)
EmailRegexp is a Regular expression for RFC5322
Functions ¶
Types ¶
type MarkBuilder ¶
type MarkBuilder struct {
// contains filtered or unexported fields
}
MarkBuilder is a better and neater way to mark different patterns of the string
func (*MarkBuilder) Mark ¶
func (m *MarkBuilder) Mark(matcherFunc MatcherFunc, c *color.Color) *MarkBuilder
Mark marks the string with the matcher function and color
func (*MarkBuilder) MarkMany ¶
func (m *MarkBuilder) MarkMany(c *color.Color, matcherFuncs ...MatcherFunc) *MarkBuilder
MarkMany marks the string with a variable number of matcher functions and color
func (*MarkBuilder) SetString ¶
func (m *MarkBuilder) SetString(str string) *MarkBuilder
SetString sets the first parameter as the string that is going to be marked
type MarkRule ¶
type MarkRule struct { Matcher MatcherFunc Color *color.Color }
MarkRule contains marking information to be applied on log stream
type MatcherFunc ¶
MatcherFunc returns a Match which contains information about found patterns
func MatchAll ¶
func MatchAll(pattern string) MatcherFunc
MatchAll creates a MatcherFunc that matches all patterns in given string
func MatchBracketSurrounded ¶
func MatchBracketSurrounded() MatcherFunc
MatchBracketSurrounded is a helper utility for easy matching of bracket surrounded text
func MatchDaysOfWeek ¶
func MatchDaysOfWeek() MatcherFunc
MatchDaysOfWeek creates a MatcherFunc that matches days of the week in given string
func MatchEmail ¶
func MatchEmail() MatcherFunc
MatchEmail creates a MatcherFunc that matches emails which meets the conditions of RFC5322 standard
func MatchMultiple ¶
func MatchMultiple(patternsToMatch []string) MatcherFunc
MatchMultiple creates a MatcherFunc that matches all string patterns from given slice in given string
func MatchN ¶
func MatchN(pattern string, n int) MatcherFunc
MatchN creates a MatcherFunc that matches first n patterns in given string
func MatchParensSurrounded ¶
func MatchParensSurrounded() MatcherFunc
MatchParensSurrounded is a helper utility for easy matching text surrounded in parentheses
func MatchRegexp ¶
func MatchRegexp(r *regexp.Regexp) MatcherFunc
MatchRegexp creates a MatcherFunc that matches given regexp in given string
func MatchSurrounded ¶
func MatchSurrounded(opening string, closure string) MatcherFunc
MatchSurrounded creates a MatcherFunc that matches the patterns surrounded by given opening and closure strings
func MatchTimestamp ¶
func MatchTimestamp(layout string) MatcherFunc
MatchTimestamp creates a MatcherFunc that matches given time layout pattern in given string
type WriteMarker ¶
type WriteMarker struct {
// contains filtered or unexported fields
}
WriteMarker contains specified rules for applying them on output
func NewStdoutMarker ¶
func NewStdoutMarker() *WriteMarker
NewStdoutMarker creates a WriteMarker with default out as os.Stdout
func NewWriteMarker ¶
func NewWriteMarker(writer io.Writer) *WriteMarker
NewWriteMarker creates a Marker that writes out to the given io.Writer
func (*WriteMarker) AddRule ¶
func (s *WriteMarker) AddRule(rule MarkRule) *WriteMarker
AddRule appends a rule to WriteMarker and returns itself
func (*WriteMarker) AddRules ¶
func (s *WriteMarker) AddRules(rules []MarkRule)
AddRules appends all rules from given slice to WriteMarker rules
type WriteMarkerOption ¶
type WriteMarkerOption func(*WriteMarker)
WriteMarkerOption is functional option type for WriteMarker