log

package
v0.0.0-...-fb5fdcc Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Level_name = map[int32]string{
		0:  "inherit",
		1:  "debug",
		2:  "info",
		3:  "warning",
		4:  "error",
		-1: "all",
	}
	Level_value = map[string]int32{
		"inherit": 0,
		"debug":   1,
		"info":    2,
		"warning": 3,
		"error":   4,
		"all":     -1,
	}
)

Enum value maps for Level.

View Source
var File_component_log_log_proto protoreflect.FileDescriptor

Functions

func New

func New(config *Config) (*zap.Logger, error)

func RegisterTarget

func RegisterTarget(target Target)

Types

type Config

type Config struct {

	// Targets 记录器
	Targets map[string]*structpb.Struct `` /* 155-byte string literal not displayed */
	// Stdout 输出到控制台
	Stdout bool `protobuf:"varint,2,opt,name=stdout,proto3" json:"stdout,omitempty"`
	// TraceLevel 记录堆栈行号
	TraceLevel int32 `protobuf:"varint,3,opt,name=trace_level,json=traceLevel,proto3" json:"trace_level,omitempty"`
	// level 最小日志等级
	Level Level `protobuf:"varint,4,opt,name=level,proto3,enum=component.log.Level" json:"level,omitempty"`
	// levels 仅限设置的日志等级
	Levels []Level `protobuf:"varint,5,rep,packed,name=levels,proto3,enum=component.log.Level" json:"levels,omitempty"`
	// Messages 记录固定的消息
	Messages map[string]*structpb.Value `` /* 157-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) GetLevel

func (x *Config) GetLevel() Level

func (*Config) GetLevels

func (x *Config) GetLevels() []Level

func (*Config) GetMessages

func (x *Config) GetMessages() map[string]*structpb.Value

func (*Config) GetStdout

func (x *Config) GetStdout() bool

func (*Config) GetTargets

func (x *Config) GetTargets() map[string]*structpb.Struct

func (*Config) GetTraceLevel

func (x *Config) GetTraceLevel() int32

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect

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

func (*Config) Reset

func (x *Config) Reset()

func (*Config) String

func (x *Config) String() string

type Level

type Level int32
const (
	Level_inherit Level = 0
	Level_debug   Level = 1
	Level_info    Level = 2
	Level_warning Level = 3
	Level_error   Level = 4
	Level_all     Level = -1
)

func (Level) Descriptor

func (Level) Descriptor() protoreflect.EnumDescriptor

func (Level) Enum

func (x Level) Enum() *Level

func (Level) EnumDescriptor deprecated

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

Deprecated: Use Level.Descriptor instead.

func (Level) Number

func (x Level) Number() protoreflect.EnumNumber

func (Level) String

func (x Level) String() string

func (Level) Type

func (Level) Type() protoreflect.EnumType

type Target

type Target interface {
	Name() string
	Register(data []byte) (io.Writer, error)
}

func GetTarget

func GetTarget(name string) Target

type TargetConfig

type TargetConfig struct {
	Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
	// level 最小日志等级
	Level Level `protobuf:"varint,2,opt,name=level,proto3,enum=component.log.Level" json:"level,omitempty"`
	// levels 仅限设置的日志等级
	Levels []Level `protobuf:"varint,3,rep,packed,name=levels,proto3,enum=component.log.Level" json:"levels,omitempty"`
	// contains filtered or unexported fields
}

func (*TargetConfig) Descriptor deprecated

func (*TargetConfig) Descriptor() ([]byte, []int)

Deprecated: Use TargetConfig.ProtoReflect.Descriptor instead.

func (*TargetConfig) GetLevel

func (x *TargetConfig) GetLevel() Level

func (*TargetConfig) GetLevels

func (x *TargetConfig) GetLevels() []Level

func (*TargetConfig) GetType

func (x *TargetConfig) GetType() string

func (*TargetConfig) ProtoMessage

func (*TargetConfig) ProtoMessage()

func (*TargetConfig) ProtoReflect

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

func (*TargetConfig) Reset

func (x *TargetConfig) Reset()

func (*TargetConfig) String

func (x *TargetConfig) String() string

Jump to

Keyboard shortcuts

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