Documentation ¶
Index ¶
- func New(options ...Option) logrus.Formatter
- type Option
- func WithCallerPrettyfier(value func(*runtime.Frame) (function string, file string)) Option
- func WithDisableColors(value bool) Option
- func WithDisableLevelTruncation(value bool) Option
- func WithDisableQuote(value bool) Option
- func WithDisableSorting(value bool) Option
- func WithDisableTimestamp(value bool) Option
- func WithEnvironmentOverrideColors(value bool) Option
- func WithFieldMap(value logrus.FieldMap) Option
- func WithForceColors(value bool) Option
- func WithForceQuote(value bool) Option
- func WithFullTimestamp(value bool) Option
- func WithPadLevelText(value bool) Option
- func WithQuoteEmptyFields(value bool) Option
- func WithSortingFunc(value func([]string)) Option
- func WithTimestampFormat(value string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(formatter *logrus.TextFormatter)
Option represents a text formatter options.
func WithCallerPrettyfier ¶
WithCallerPrettyfier sets formatter's caller prettyfier to value. Can be set by the user to modify the content of the function and file keys in the data when ReportCaller is activated. If any of the returned value is the empty string the corresponding key will be removed from fields.
func WithDisableColors ¶
WithDisableColors sets formatter's disable colors to value.
func WithDisableLevelTruncation ¶
WithDisableLevelTruncation sets formatter's disable level truncation to value. Disables the truncation of the level text to 4 characters.
func WithDisableQuote ¶
WithDisableQuote sets formatter's disable quote to value.
func WithDisableSorting ¶
WithDisableSorting sets formatter's disable sorting to value. The fields are sorted by default for a consistent output. For applications that log extremely frequently and don't use the JSON formatter this may not be desired.
func WithDisableTimestamp ¶
WithDisableTimestamp sets formatter's disable timestamp to value. Disable timestamps is useful when output is redirected to logging system that already adds timestamps.
func WithEnvironmentOverrideColors ¶
WithEnviromentOverrideColors sets formatter's override colors to value. Override coloring based on CLICOLOR and CLICOLOR_FORCE. - https://bixense.com/clicolors/
func WithFieldMap ¶
WithFieldMap sets formatter's field map to value.
func WithForceColors ¶
WithForceColors sets formatter's force colors to value.
func WithForceQuote ¶
WithForceQuote sets formatter's force quote to value.
func WithFullTimestamp ¶
WithFullTimestamp sets formatter's full timestamp to value.
func WithPadLevelText ¶
WithPadLevelText sets formatter's pad level text to value. Adds padding the level text so that all the levels output at the same length PadLevelText is a superset of the DisableLevelTruncation option.
func WithQuoteEmptyFields ¶
WithQuoteEmptyFields sets formatter's quote empty fields to value. This will wrap empty fields in quotes if true.
func WithSortingFunc ¶
WithSortingFunc sets formatter's sorting func to value. The keys sorting function, when uninitialized it uses sort.Strings.
func WithTimestampFormat ¶
WithTimestampFormat sets formatter's timestamp format to value. The format to use is the same than for time.Format or time.Parse from the standard library.