logs

package
v0.0.60 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: MIT Imports: 18 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DefaultMaxAge         = 72 * time.Hour
	DefaultMaxCount       = 72
	DefaultRotateInterval = time.Hour
	//100MB
	DefaultRotateSize = 104857600
)

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,
		"info":  4,
		"debug": 5,
		"trace": 6,
	}
)

Enum value maps for Log_Level.

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

View Source
var File_pkg_logs_log_proto protoreflect.FileDescriptor

Functions

func WithRotate

func WithRotate(log *logrus.Logger, filedir string, options ...RotateOption) error

Types

type CallerPrettyfierFunc

type CallerPrettyfierFunc func(f *runtime.Frame) (function string, file string)

func GenShortCallPrettyfier

func GenShortCallPrettyfier() CallerPrettyfierFunc

type CompletedConfig

type CompletedConfig struct {
	// contains filtered or unexported fields
}

func (CompletedConfig) Apply

func (c CompletedConfig) Apply() error

func (CompletedConfig) Validate

func (c CompletedConfig) Validate() error

Validate checks Config.

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

type HookHandler func(entry *logrus.Entry) error

func (HookHandler) Fire

func (h HookHandler) Fire(entry *logrus.Entry) error

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) Descriptor() ([]byte, []int)

Deprecated: Use Log.ProtoReflect.Descriptor instead.

func (*Log) GetFilepath

func (x *Log) GetFilepath() string

func (*Log) GetFormatter

func (x *Log) GetFormatter() Log_Formatter

func (*Log) GetLevel

func (x *Log) GetLevel() Log_Level

func (*Log) GetMaxAge

func (x *Log) GetMaxAge() *duration.Duration

func (*Log) GetMaxCount

func (x *Log) GetMaxCount() int64

func (*Log) GetReportCaller

func (x *Log) GetReportCaller() bool

func (*Log) GetRotateInterval

func (x *Log) GetRotateInterval() *duration.Duration

func (*Log) GetRotateSize

func (x *Log) GetRotateSize() int64

func (*Log) ProtoMessage

func (*Log) ProtoMessage()

func (*Log) ProtoReflect

func (x *Log) ProtoReflect() protoreflect.Message

func (*Log) Reset

func (x *Log) Reset()

func (*Log) String

func (x *Log) String() string

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) 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 (Log_Formatter) String

func (x Log_Formatter) String() string

func (Log_Formatter) Type

type Log_Level

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_info  Log_Level = 4
	Log_debug Log_Level = 5
	Log_trace Log_Level = 6
)

func (Log_Level) Descriptor

func (Log_Level) Descriptor() protoreflect.EnumDescriptor

func (Log_Level) Enum

func (x Log_Level) Enum() *Log_Level

func (Log_Level) EnumDescriptor deprecated

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

Deprecated: Use Log_Level.Descriptor instead.

func (Log_Level) Number

func (x Log_Level) Number() protoreflect.EnumNumber

func (Log_Level) String

func (x Log_Level) String() string

func (Log_Level) Type

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.

Jump to

Keyboard shortcuts

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