Documentation ¶
Index ¶
- Variables
- func InitLog()
- func RegisterDefaults(scheme *runtime.Scheme) error
- func RegisterVipers(scheme *runtime.Scheme) error
- type CompletedConfig
- type Config
- type Log
- func (*Log) Descriptor() ([]byte, []int)deprecated
- func (x *Log) GetFormat() Log_Format
- func (x *Log) GetLevel() Log_Level
- func (x *Log) GetMuteDirectlyOutput() bool
- func (x *Log) GetPath() string
- func (x *Log) GetReportCaller() bool
- func (x *Log) GetRotationDuration() *durationpb.Duration
- func (x *Log) GetRotationMaxAge() *durationpb.Duration
- func (x *Log) GetRotationMaxCount() int32
- func (*Log) ProtoMessage()
- func (x *Log) ProtoReflect() protoreflect.Message
- func (x *Log) Reset()
- func (x *Log) String() string
- type Log_Format
- type Log_Level
Constants ¶
This section is empty.
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, "warning": 3, "info": 4, "debug": 5, "trace": 6, } )
Enum value maps for Log_Level.
var ( Log_Format_name = map[int32]string{ 0: "json", 1: "text", } Log_Format_value = map[string]int32{ "json": 0, "text": 1, } )
Enum value maps for Log_Format.
var (
// AddToScheme applies all the stored functions to the scheme.
AddToScheme = localSchemeBuilder.AddToScheme
)
var File_log_proto protoreflect.FileDescriptor
Functions ¶
func RegisterDefaults ¶ added in v0.0.41
RegisterDefaults adds defaulters functions to the given scheme. Public to allow building arbitrary schemes. All generated defaulters are covering - they call all nested defaulters.
func RegisterVipers ¶ added in v0.0.41
RegisterVipers adds vipers functions to the given scheme. Public to allow building arbitrary schemes. All generated defaulters are covering - they call all nested defaulters.
Types ¶
type CompletedConfig ¶
type CompletedConfig struct {
// contains filtered or unexported fields
}
type Config ¶
type Config struct { GetViper func() *viper.Viper // If set, overrides params below Proto Log Validator *validator.Validate }
func NewViperConfig ¶ added in v0.0.17
NewViperConfig returns a Config struct with the global viper instance key representing a sub tree of this instance. NewViperConfig is case-insensitive for a key.
func (*Config) Complete ¶
func (c *Config) Complete() CompletedConfig
Complete fills in any fields not set that are required to have valid data and can be derived from other fields. If you're going to `ApplyOptions`, do that first. It's mutating the receiver.
func (*Config) SetDefaultsConfig ¶ added in v0.0.41
SetDefaultsConfig assigns default values for the Config
type Log ¶ added in v0.0.17
type Log struct { Level Log_Level `protobuf:"varint,1,opt,name=level,proto3,enum=sole.api.v1.viper.logs.Log_Level" json:"level,omitempty"` // 日志最低打印等级 Format Log_Format `protobuf:"varint,2,opt,name=format,proto3,enum=sole.api.v1.viper.logs.Log_Format" json:"format,omitempty"` // 日志格式 Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"` //日志存储路径 RotationDuration *durationpb.Duration `protobuf:"bytes,4,opt,name=rotation_duration,json=rotationDuration,proto3" json:"rotation_duration,omitempty"` // 日志循环覆盖分片时间 RotationMaxCount int32 `protobuf:"varint,5,opt,name=rotation_max_count,json=rotationMaxCount,proto3" json:"rotation_max_count,omitempty"` //日志循环覆盖保留分片个数 RotationMaxAge *durationpb.Duration `protobuf:"bytes,6,opt,name=rotation_max_age,json=rotationMaxAge,proto3" json:"rotation_max_age,omitempty"` // 文件最大保存时间 ReportCaller bool `protobuf:"varint,7,opt,name=report_caller,json=reportCaller,proto3" json:"report_caller,omitempty"` // 调用者堆栈 MuteDirectlyOutput bool `protobuf:"varint,8,opt,name=mute_directly_output,json=muteDirectlyOutput,proto3" json:"mute_directly_output,omitempty"` // warn及更高级别日志是否打印到标准输出 // contains filtered or unexported fields }
func (*Log) Descriptor
deprecated
added in
v0.0.17
func (*Log) GetFormat ¶ added in v0.0.17
func (x *Log) GetFormat() Log_Format
func (*Log) GetMuteDirectlyOutput ¶ added in v0.0.42
func (*Log) GetReportCaller ¶ added in v0.0.17
func (*Log) GetRotationDuration ¶ added in v0.0.17
func (x *Log) GetRotationDuration() *durationpb.Duration
func (*Log) GetRotationMaxAge ¶ added in v0.0.17
func (x *Log) GetRotationMaxAge() *durationpb.Duration
func (*Log) GetRotationMaxCount ¶ added in v0.0.17
func (*Log) ProtoMessage ¶ added in v0.0.17
func (*Log) ProtoMessage()
func (*Log) ProtoReflect ¶ added in v0.0.17
func (x *Log) ProtoReflect() protoreflect.Message
type Log_Format ¶ added in v0.0.17
type Log_Format int32
日志格式
const ( Log_json Log_Format = 0 Log_text Log_Format = 1 )
func (Log_Format) Descriptor ¶ added in v0.0.17
func (Log_Format) Descriptor() protoreflect.EnumDescriptor
func (Log_Format) Enum ¶ added in v0.0.17
func (x Log_Format) Enum() *Log_Format
func (Log_Format) EnumDescriptor
deprecated
added in
v0.0.17
func (Log_Format) EnumDescriptor() ([]byte, []int)
Deprecated: Use Log_Format.Descriptor instead.
func (Log_Format) Number ¶ added in v0.0.17
func (x Log_Format) Number() protoreflect.EnumNumber
func (Log_Format) String ¶ added in v0.0.17
func (x Log_Format) String() string
func (Log_Format) Type ¶ added in v0.0.17
func (Log_Format) Type() protoreflect.EnumType
type Log_Level ¶ added in v0.0.17
type Log_Level int32
日志等级
func (Log_Level) Descriptor ¶ added in v0.0.17
func (Log_Level) Descriptor() protoreflect.EnumDescriptor
func (Log_Level) EnumDescriptor
deprecated
added in
v0.0.17
func (Log_Level) Number ¶ added in v0.0.17
func (x Log_Level) Number() protoreflect.EnumNumber
func (Log_Level) Type ¶ added in v0.0.17
func (Log_Level) Type() protoreflect.EnumType