log

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 License: BSD-3-Clause Imports: 23 Imported by: 33

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLevel = "info"
View Source
var File_encoder_proto protoreflect.FileDescriptor
View Source
var TimeLocation = time.FixedZone("CST", 8*3600)

Functions

func DPanic

func DPanic(msg string, fields ...zap.Field)

func Debug

func Debug(msg string, fields ...zap.Field)

func Error

func Error(msg string, fields ...zap.Field)

func GetCallerField added in v1.0.1

func GetCallerField(fields ...zap.Field) []zap.Field

func GetLogger

func GetLogger() *zap.Logger

func Info

func Info(msg string, fields ...zap.Field)

func InitLogger

func InitLogger(force bool)

func LoadConfig

func LoadConfig()

func Panic

func Panic(msg string, fields ...zap.Field)

func ResetLogger

func ResetLogger(fields ...zap.Field)

func SetLevel added in v1.0.1

func SetLevel(level string)

func Warn

func Warn(msg string, fields ...zap.Field)

Types

type Config

type Config struct {
	Level         string        `mapstructure:"level,omitempty" json:"level,omitempty"`
	FileConfig    FileLogConfig `mapstructure:"file_config,omitempty" json:"file_config,omitempty"`
	EnableConsole bool          `mapstructure:"enable_console,omitempty" json:"enable_console,omitempty"`
	EnableColor   bool          `mapstructure:"enable_color,omitempty" json:"enable_color,omitempty"`
	EnableSampler bool          `mapstructure:"enable_sampler,omitempty" json:"enable_sampler,omitempty"`
}

type FileLogConfig

type FileLogConfig struct {
	FileName   string `mapstructure:"file_name,omitempty" json:"file_name,omitempty"`
	Enable     bool   `mapstructure:"enable,omitempty" json:"enable,omitempty"`
	Maxsize    int    `mapstructure:"maxsize,omitempty" json:"maxsize,omitempty"`
	MaxBackups int    `mapstructure:"max_backups,omitempty" json:"max_backups,omitempty"`
	MaxAge     int    `mapstructure:"max_age,omitempty" json:"max_age,omitempty"`
	Compress   bool   `mapstructure:"compress,omitempty" json:"compress,omitempty"`
}

type LogBody

type LogBody struct {
	Level      int32           `protobuf:"varint,1,opt,name=level,proto3" json:"level,omitempty"`
	Time       int64           `protobuf:"varint,2,opt,name=time,proto3" json:"time,omitempty"`
	LoggerName string          `protobuf:"bytes,3,opt,name=logger_name,json=loggerName,proto3" json:"logger_name,omitempty"`
	Message    string          `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"`
	Stack      string          `protobuf:"bytes,5,opt,name=stack,proto3" json:"stack,omitempty"`
	Caller     *LogEntryCaller `protobuf:"bytes,6,opt,name=caller,proto3" json:"caller,omitempty"`
	Fields     string          `protobuf:"bytes,7,opt,name=fields,proto3" json:"fields,omitempty"`
	// contains filtered or unexported fields
}

func (*LogBody) Descriptor deprecated

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

Deprecated: Use LogBody.ProtoReflect.Descriptor instead.

func (*LogBody) GetCaller

func (x *LogBody) GetCaller() *LogEntryCaller

func (*LogBody) GetFields

func (x *LogBody) GetFields() string

func (*LogBody) GetLevel

func (x *LogBody) GetLevel() int32

func (*LogBody) GetLoggerName

func (x *LogBody) GetLoggerName() string

func (*LogBody) GetMessage

func (x *LogBody) GetMessage() string

func (*LogBody) GetStack

func (x *LogBody) GetStack() string

func (*LogBody) GetTime

func (x *LogBody) GetTime() int64

func (*LogBody) ProtoMessage

func (*LogBody) ProtoMessage()

func (*LogBody) ProtoReflect

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

func (*LogBody) Reset

func (x *LogBody) Reset()

func (*LogBody) String

func (x *LogBody) String() string

type LogEntryCaller

type LogEntryCaller struct {
	Defined bool `protobuf:"varint,1,opt,name=defined,proto3" json:"defined,omitempty"`
	//    	PC       uintptr
	File     string `protobuf:"bytes,2,opt,name=file,proto3" json:"file,omitempty"`
	Line     int32  `protobuf:"varint,3,opt,name=line,proto3" json:"line,omitempty"`
	Function string `protobuf:"bytes,4,opt,name=function,proto3" json:"function,omitempty"`
	// contains filtered or unexported fields
}

func (*LogEntryCaller) Descriptor deprecated

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

Deprecated: Use LogEntryCaller.ProtoReflect.Descriptor instead.

func (*LogEntryCaller) GetDefined

func (x *LogEntryCaller) GetDefined() bool

func (*LogEntryCaller) GetFile

func (x *LogEntryCaller) GetFile() string

func (*LogEntryCaller) GetFunction

func (x *LogEntryCaller) GetFunction() string

func (*LogEntryCaller) GetLine

func (x *LogEntryCaller) GetLine() int32

func (*LogEntryCaller) ProtoMessage

func (*LogEntryCaller) ProtoMessage()

func (*LogEntryCaller) ProtoReflect

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

func (*LogEntryCaller) Reset

func (x *LogEntryCaller) Reset()

func (*LogEntryCaller) String

func (x *LogEntryCaller) String() string

type PBWrite

type PBWrite interface {
	zapcore.WriteSyncer
}

type Service

type Service interface {
	GetLogger() *zap.Logger
	InitLogger(force bool)
	ResetLogger(fields ...zap.Field)
	SendLog(level zapcore.Level, msg string, fields ...zap.Field)
	LoadConfig()
	SetLevel(level string)
	PrintLog(write io.Writer)

	RegisterAccept(logWrite chan<- []byte) int64
	UnRegisterAccept(id int64)
}

func GetService

func GetService() Service

Jump to

Keyboard shortcuts

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