logs

package
v0.0.45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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.

View Source
var (

	// AddToScheme applies all the stored functions to the scheme.
	AddToScheme = localSchemeBuilder.AddToScheme
)

Functions

func InitLog

func InitLog()

InitLog initializes logs the way we want for kubernetes.

func RegisterDefaults added in v0.0.41

func RegisterDefaults(scheme *runtime.Scheme) error

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

func RegisterVipers(scheme *runtime.Scheme) error

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
}

func (CompletedConfig) Apply

func (c CompletedConfig) Apply() error

Apply creates a new server which logically combines the handling chain with the passed server. name is used to differentiate for logging. The handler chain in particular can be difficult as it starts delgating.

func (CompletedConfig) Validate added in v0.0.44

func (c CompletedConfig) Validate() error

Validate checks Config.

type Config

type Config struct {
	GetViper  func() *viper.Viper // If set, overrides params below
	Proto     Log
	Validator *validator.Validate
}

func NewConfig

func NewConfig() *Config

NewConfig returns a Config struct with the default values

func NewViperConfig added in v0.0.17

func NewViperConfig(getViper func() *viper.Viper) *Config

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

func (c *Config) SetDefaultsConfig() *Config

SetDefaultsConfig assigns default values for the Config

func (*Config) SetViperConfig added in v0.0.41

func (c *Config) SetViperConfig(v *viper.Viper) error

SetViperConfig assigns values from viper 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) Descriptor() ([]byte, []int)

Deprecated: Use Log.ProtoReflect.Descriptor instead.

func (*Log) GetFormat added in v0.0.17

func (x *Log) GetFormat() Log_Format

func (*Log) GetLevel added in v0.0.17

func (x *Log) GetLevel() Log_Level

func (*Log) GetMuteDirectlyOutput added in v0.0.42

func (x *Log) GetMuteDirectlyOutput() bool

func (*Log) GetPath added in v0.0.17

func (x *Log) GetPath() string

func (*Log) GetReportCaller added in v0.0.17

func (x *Log) GetReportCaller() bool

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 (x *Log) GetRotationMaxCount() int32

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

func (*Log) Reset added in v0.0.17

func (x *Log) Reset()

func (*Log) String added in v0.0.17

func (x *Log) String() string

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

type Log_Level added in v0.0.17

type Log_Level int32

日志等级

const (
	Log_panic   Log_Level = 0
	Log_fatal   Log_Level = 1
	Log_error   Log_Level = 2
	Log_warn    Log_Level = 3
	Log_warning Log_Level = 3
	Log_info    Log_Level = 4
	Log_debug   Log_Level = 5
	Log_trace   Log_Level = 6
)

func (Log_Level) Descriptor added in v0.0.17

func (Log_Level) Descriptor() protoreflect.EnumDescriptor

func (Log_Level) Enum added in v0.0.17

func (x Log_Level) Enum() *Log_Level

func (Log_Level) EnumDescriptor deprecated added in v0.0.17

func (Log_Level) EnumDescriptor() ([]byte, []int)

Deprecated: Use Log_Level.Descriptor instead.

func (Log_Level) Number added in v0.0.17

func (x Log_Level) Number() protoreflect.EnumNumber

func (Log_Level) String added in v0.0.17

func (x Log_Level) String() string

func (Log_Level) Type added in v0.0.17

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL