Documentation ¶
Index ¶
- Variables
- func DPanic(msg string, fields ...zap.Field)
- func Debug(msg string, fields ...zap.Field)
- func Error(msg string, fields ...zap.Field)
- func GetCallerField(fields ...zap.Field) []zap.Field
- func GetLogger() *zap.Logger
- func Info(msg string, fields ...zap.Field)
- func InitLogger(force bool)
- func LoadConfig()
- func Panic(msg string, fields ...zap.Field)
- func ResetLogger(fields ...zap.Field)
- func SetLevel(level string)
- func Warn(msg string, fields ...zap.Field)
- type Config
- type FileLogConfig
- type LogBody
- func (*LogBody) Descriptor() ([]byte, []int)deprecated
- func (x *LogBody) GetCaller() *LogEntryCaller
- func (x *LogBody) GetFields() string
- func (x *LogBody) GetLevel() int32
- func (x *LogBody) GetLoggerName() string
- func (x *LogBody) GetMessage() string
- func (x *LogBody) GetStack() string
- func (x *LogBody) GetTime() int64
- func (*LogBody) ProtoMessage()
- func (x *LogBody) ProtoReflect() protoreflect.Message
- func (x *LogBody) Reset()
- func (x *LogBody) String() string
- type LogEntryCaller
- func (*LogEntryCaller) Descriptor() ([]byte, []int)deprecated
- func (x *LogEntryCaller) GetDefined() bool
- func (x *LogEntryCaller) GetFile() string
- func (x *LogEntryCaller) GetFunction() string
- func (x *LogEntryCaller) GetLine() int32
- func (*LogEntryCaller) ProtoMessage()
- func (x *LogEntryCaller) ProtoReflect() protoreflect.Message
- func (x *LogEntryCaller) Reset()
- func (x *LogEntryCaller) String() string
- type PBWrite
- type Service
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 InitLogger ¶
func InitLogger(force bool)
func LoadConfig ¶
func LoadConfig()
func ResetLogger ¶
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) GetCaller ¶
func (x *LogBody) GetCaller() *LogEntryCaller
func (*LogBody) GetLoggerName ¶
func (*LogBody) GetMessage ¶
func (*LogBody) ProtoMessage ¶
func (*LogBody) ProtoMessage()
func (*LogBody) ProtoReflect ¶
func (x *LogBody) ProtoReflect() protoreflect.Message
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
Click to show internal directories.
Click to hide internal directories.