Documentation
¶
Overview ¶
Code generated by go-enum DO NOT EDIT.
Index ¶
- Variables
- func Configure(cfg *Config)
- func ConfigureLogger(logger *logrus.Logger, cfg *Config)
- func CtxWithFields(ctx context.Context, fields logrus.Fields) (context.Context, *logrus.Entry)
- func EscapeInput(input string) string
- func FormatTypeNames() []string
- func FromCtx(ctx context.Context) *logrus.Entry
- func Log() *logrus.Logger
- func NewCtx(ctx context.Context, logger *logrus.Entry) (context.Context, *logrus.Entry)
- func PrefixedLog(prefix string) *logrus.Entry
- func Silence()
- func WithIndent(log *logrus.Entry, prefix string, callback func(*logrus.Entry))
- func WithPrefix(logger *logrus.Entry, prefix string) *logrus.Entry
- func WrapCtx(ctx context.Context, wrap func(*logrus.Entry) *logrus.Entry) (context.Context, *logrus.Entry)
- type Config
- type FormatType
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidFormatType = fmt.Errorf("not a valid FormatType, try [%s]", strings.Join(_FormatTypeNames, ", "))
Functions ¶
func ConfigureLogger ¶
Configure applies configuration to the given logger.
func CtxWithFields ¶
func FormatTypeNames ¶
func FormatTypeNames() []string
FormatTypeNames returns a list of possible string values of FormatType.
func PrefixedLog ¶
PrefixedLog return the global logger with prefix
func WithPrefix ¶
WithPrefix adds the given prefix to the logger.
Types ¶
type Config ¶
type Config struct {
Level logrus.Level `yaml:"level" default:"info"`
Format FormatType `yaml:"format" default:"text"`
Privacy bool `yaml:"privacy" default:"false"`
Timestamp bool `yaml:"timestamp" default:"true"`
}
Config defines all logging configurations
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a new Config initialized with default values.
type FormatType ¶
type FormatType int
FormatType format for logging ENUM( text // logging as text json // JSON format )
const ( // FormatTypeText is a FormatType of type Text. // logging as text FormatTypeText FormatType = iota // FormatTypeJson is a FormatType of type Json. // JSON format FormatTypeJson )
func ParseFormatType ¶
func ParseFormatType(name string) (FormatType, error)
ParseFormatType attempts to convert a string to a FormatType.
func (FormatType) IsValid ¶
func (x FormatType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (FormatType) MarshalText ¶
func (x FormatType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (FormatType) String ¶
func (x FormatType) String() string
String implements the Stringer interface.
func (*FormatType) UnmarshalText ¶
func (x *FormatType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.