Documentation ¶
Index ¶
- Constants
- Variables
- func WithRotate(log *logrus.Logger, filedir string, options ...RotateOption) error
- type CallerPrettyfierFunc
- type CompletedConfig
- type Config
- type ConfigOption
- type ConfigOptionFunc
- type EmptyConfigOption
- type EmptyRotateOption
- type HookHandler
- type Log
- func (*Log) Descriptor() ([]byte, []int)deprecated
- func (x *Log) GetFilepath() string
- func (x *Log) GetFormatter() Log_Formatter
- func (x *Log) GetLevel() Log_Level
- func (x *Log) GetMaxAge() *duration.Duration
- func (x *Log) GetMaxCount() int64
- func (x *Log) GetReportCaller() bool
- func (x *Log) GetRotateInterval() *duration.Duration
- func (x *Log) GetRotateSize() int64
- func (*Log) ProtoMessage()
- func (x *Log) ProtoReflect() protoreflect.Message
- func (x *Log) Reset()
- func (x *Log) String() string
- type Log_Formatter
- func (Log_Formatter) Descriptor() protoreflect.EnumDescriptor
- func (x Log_Formatter) Enum() *Log_Formatter
- func (Log_Formatter) EnumDescriptor() ([]byte, []int)deprecated
- func (x Log_Formatter) Number() protoreflect.EnumNumber
- func (x Log_Formatter) String() string
- func (Log_Formatter) Type() protoreflect.EnumType
- type Log_Level
- type Rotate
- type RotateOption
- func WithMaxAge(maxAge time.Duration) RotateOption
- func WithMaxCount(maxCount int64) RotateOption
- func WithPrefixName(prefixName string) RotateOption
- func WithRotateInterval(rotateInterval time.Duration) RotateOption
- func WithRotateSize(rotateSize int64) RotateOption
- func WithSuffixName(suffixName string) RotateOption
- type RotateOptionFunc
Constants ¶
const ( DefaultMaxAge = 72 * time.Hour DefaultMaxCount = 72 DefaultRotateInterval = time.Hour //100MB DefaultRotateSize = 104857600 )
Variables ¶
var ( Log_Level_name = map[int32]string{ 0: "panic", 1: "fatal", 2: "error", 3: "warn", 4: "info", 5: "debug", 6: "trace", } Log_Level_value = map[string]int32{ "panic": 0, "fatal": 1, "error": 2, "warn": 3, "info": 4, "debug": 5, "trace": 6, } )
Enum value maps for Log_Level.
var ( Log_Formatter_name = map[int32]string{ 0: "text", 1: "json", } Log_Formatter_value = map[string]int32{ "text": 0, "json": 1, } )
Enum value maps for Log_Formatter.
var File_pkg_logs_log_proto protoreflect.FileDescriptor
Functions ¶
func WithRotate ¶
func WithRotate(log *logrus.Logger, filedir string, options ...RotateOption) error
Types ¶
type CallerPrettyfierFunc ¶
func GenShortCallPrettyfier ¶
func GenShortCallPrettyfier() CallerPrettyfierFunc
type CompletedConfig ¶
type CompletedConfig struct {
// contains filtered or unexported fields
}
type Config ¶
type Config struct { Proto Log Validator *validator.Validate // contains filtered or unexported fields }
func NewConfig ¶
func NewConfig(options ...ConfigOption) *Config
func (*Config) ApplyOptions ¶
func (o *Config) ApplyOptions(options ...ConfigOption) *Config
func (*Config) Complete ¶
func (c *Config) Complete() CompletedConfig
Complete set default ServerRunOptions.
type ConfigOption ¶
type ConfigOption interface {
// contains filtered or unexported methods
}
A ConfigOption sets options.
func WithViper ¶
func WithViper(v *viper.Viper) ConfigOption
type ConfigOptionFunc ¶
type ConfigOptionFunc func(*Config)
ConfigOptionFunc wraps a function that modifies Client into an implementation of the ConfigOption interface.
type EmptyConfigOption ¶
type EmptyConfigOption struct{}
EmptyConfigOption does not alter the configuration. It can be embedded in another structure to build custom options.
This API is EXPERIMENTAL.
type EmptyRotateOption ¶
type EmptyRotateOption struct{}
EmptyRotateOption does not alter the configuration. It can be embedded in another structure to build custom options.
This API is EXPERIMENTAL.
type HookHandler ¶
func (HookHandler) Levels ¶
func (h HookHandler) Levels() []logrus.Level
type Log ¶
type Log struct { Level Log_Level `protobuf:"varint,1,opt,name=level,proto3,enum=api.v1.viper.logs.Log_Level" json:"level,omitempty"` Formatter Log_Formatter `protobuf:"varint,2,opt,name=formatter,proto3,enum=api.v1.viper.logs.Log_Formatter" json:"formatter,omitempty"` Filepath string `protobuf:"bytes,3,opt,name=filepath,proto3" json:"filepath,omitempty"` MaxAge *duration.Duration `protobuf:"bytes,4,opt,name=max_age,json=maxAge,proto3" json:"max_age,omitempty"` MaxCount int64 `protobuf:"varint,5,opt,name=max_count,json=maxCount,proto3" json:"max_count,omitempty"` RotateInterval *duration.Duration `protobuf:"bytes,6,opt,name=rotate_interval,json=rotateInterval,proto3" json:"rotate_interval,omitempty"` RotateSize int64 `protobuf:"varint,7,opt,name=rotate_size,json=rotateSize,proto3" json:"rotate_size,omitempty"` ReportCaller bool `protobuf:"varint,8,opt,name=report_caller,json=reportCaller,proto3" json:"report_caller,omitempty"` // contains filtered or unexported fields }
func (*Log) Descriptor
deprecated
func (*Log) GetFilepath ¶
func (*Log) GetFormatter ¶
func (x *Log) GetFormatter() Log_Formatter
func (*Log) GetMaxCount ¶
func (*Log) GetReportCaller ¶
func (*Log) GetRotateInterval ¶
func (*Log) GetRotateSize ¶
func (*Log) ProtoMessage ¶
func (*Log) ProtoMessage()
func (*Log) ProtoReflect ¶
func (x *Log) ProtoReflect() protoreflect.Message
type Log_Formatter ¶
type Log_Formatter int32
const ( Log_text Log_Formatter = 0 Log_json Log_Formatter = 1 )
func (Log_Formatter) Descriptor ¶
func (Log_Formatter) Descriptor() protoreflect.EnumDescriptor
func (Log_Formatter) Enum ¶
func (x Log_Formatter) Enum() *Log_Formatter
func (Log_Formatter) EnumDescriptor
deprecated
func (Log_Formatter) EnumDescriptor() ([]byte, []int)
Deprecated: Use Log_Formatter.Descriptor instead.
func (Log_Formatter) Number ¶
func (x Log_Formatter) Number() protoreflect.EnumNumber
func (Log_Formatter) String ¶
func (x Log_Formatter) String() string
func (Log_Formatter) Type ¶
func (Log_Formatter) Type() protoreflect.EnumType
type Log_Level ¶
type Log_Level int32
func (Log_Level) Descriptor ¶
func (Log_Level) Descriptor() protoreflect.EnumDescriptor
func (Log_Level) EnumDescriptor
deprecated
func (Log_Level) Number ¶
func (x Log_Level) Number() protoreflect.EnumNumber
func (Log_Level) Type ¶
func (Log_Level) Type() protoreflect.EnumType
type Rotate ¶
type Rotate struct {
// contains filtered or unexported fields
}
func (*Rotate) ApplyOptions ¶
func (o *Rotate) ApplyOptions(options ...RotateOption) *Rotate
type RotateOption ¶
type RotateOption interface {
// contains filtered or unexported methods
}
A RotateOption sets options.
func WithMaxAge ¶
func WithMaxAge(maxAge time.Duration) RotateOption
func WithMaxCount ¶
func WithMaxCount(maxCount int64) RotateOption
func WithPrefixName ¶
func WithPrefixName(prefixName string) RotateOption
func WithRotateInterval ¶
func WithRotateInterval(rotateInterval time.Duration) RotateOption
func WithRotateSize ¶
func WithRotateSize(rotateSize int64) RotateOption
func WithSuffixName ¶
func WithSuffixName(suffixName string) RotateOption
type RotateOptionFunc ¶
type RotateOptionFunc func(*Rotate)
RotateOptionFunc wraps a function that modifies Client into an implementation of the RotateOption interface.