Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultFormatter = "text"
DefaultFormatter is a name of a default formatter. This formatter *must* be registered in the FormattersMap map.
View Source
var FormattersMap = map[string]func() logrus.Formatter{ "text": func() logrus.Formatter { return &formatter.XFilterFormatter{Formatter: &logrus.TextFormatter{}} }, "json": func() logrus.Formatter { return &formatter.JSONFormatter{} }, }
FormattersMap is a map of supported logrus formatters. It is safe to add custom formatters to this map.
Functions ¶
func NewLoggerFlagSet ¶
func NewLoggerFlagSet(logger *LoggerFlag) *pflag.FlagSet
Types ¶
type FormatTypeValue ¶
type FormatTypeValue struct {
// contains filtered or unexported fields
}
FormatTypeValue implements pflag.Value. It represents a flag that allow to choose a different logrus formatter.
func (*FormatTypeValue) Formatter ¶
func (f *FormatTypeValue) Formatter() logrus.Formatter
Formatter returns the logrus.Formatter for selected type.
func (*FormatTypeValue) Set ¶
func (f *FormatTypeValue) Set(v string) error
Set implements the pflag.Value interface.
func (*FormatTypeValue) String ¶
func (f *FormatTypeValue) String() string
String implements the pflag.Value interface.
func (*FormatTypeValue) Type ¶
func (f *FormatTypeValue) Type() string
Type implements the pflag.Value interface.
type LoggerFlag ¶
type LoggerFlag struct {
// contains filtered or unexported fields
}
func (*LoggerFlag) Logger ¶
func (logger *LoggerFlag) Logger() log.Logger
Click to show internal directories.
Click to hide internal directories.