Documentation ¶
Index ¶
- Variables
- func Debug(a ...interface{})
- func Debugf(format string, a ...interface{})
- func Debugw(msg string, keyvals ...interface{})
- func Error(a ...interface{})
- func ErrorPanic(err interface{})
- func ErrorStack(err error)
- func Errorf(format string, a ...interface{})
- func Errorw(msg string, keyvals ...interface{})
- func Fatal(a ...interface{})
- func Fatalf(format string, a ...interface{})
- func Fatalw(msg string, keyvals ...interface{})
- func GetCore() zapcore.Core
- func Info(a ...interface{})
- func Infof(format string, a ...interface{})
- func Infow(msg string, keyvals ...interface{})
- func Init(c *Conf) core.Logger
- func NewLoggerCore(c *Conf) (core.Logger, error)
- func SetLogger(logger *ZapLogger)
- func Warn(a ...interface{})
- func Warnf(format string, a ...interface{})
- func Warnw(msg string, keyvals ...interface{})
- func With(c zapcore.Core, kv ...interface{}) zapcore.Core
- type Conf
- func (*Conf) Descriptor() ([]byte, []int)deprecated
- func (x *Conf) GetConsole() *StdoutConf
- func (x *Conf) GetFile() *FileConf
- func (x *Conf) GetFluent() *FluentConf
- func (*Conf) ProtoMessage()
- func (x *Conf) ProtoReflect() protoreflect.Message
- func (x *Conf) Reset()
- func (x *Conf) String() string
- func (m *Conf) Validate() error
- func (m *Conf) ValidateAll() error
- type ConfMultiError
- type ConfValidationError
- type FileConf
- func (*FileConf) Descriptor() ([]byte, []int)deprecated
- func (x *FileConf) GetEnable() bool
- func (x *FileConf) GetLevel() int32
- func (x *FileConf) GetName() string
- func (x *FileConf) GetPath() string
- func (*FileConf) ProtoMessage()
- func (x *FileConf) ProtoReflect() protoreflect.Message
- func (x *FileConf) Reset()
- func (x *FileConf) String() string
- func (m *FileConf) Validate() error
- func (m *FileConf) ValidateAll() error
- type FileConfMultiError
- type FileConfValidationError
- type FluentConf
- func (*FluentConf) Descriptor() ([]byte, []int)deprecated
- func (x *FluentConf) GetAddr() string
- func (x *FluentConf) GetEnable() bool
- func (x *FluentConf) GetLevel() int32
- func (*FluentConf) ProtoMessage()
- func (x *FluentConf) ProtoReflect() protoreflect.Message
- func (x *FluentConf) Reset()
- func (x *FluentConf) String() string
- func (m *FluentConf) Validate() error
- func (m *FluentConf) ValidateAll() error
- type FluentConfMultiError
- type FluentConfValidationError
- type StdoutConf
- func (*StdoutConf) Descriptor() ([]byte, []int)deprecated
- func (x *StdoutConf) GetEnable() bool
- func (x *StdoutConf) GetLevel() int32
- func (*StdoutConf) ProtoMessage()
- func (x *StdoutConf) ProtoReflect() protoreflect.Message
- func (x *StdoutConf) Reset()
- func (x *StdoutConf) String() string
- func (m *StdoutConf) Validate() error
- func (m *StdoutConf) ValidateAll() error
- type StdoutConfMultiError
- type StdoutConfValidationError
- type ZapLogger
- func (s *ZapLogger) Debug(a ...interface{})
- func (s *ZapLogger) Debugf(format string, a ...interface{})
- func (s *ZapLogger) Debugw(msg string, keyvals ...interface{})
- func (s *ZapLogger) Error(a ...interface{})
- func (s *ZapLogger) Errorf(format string, a ...interface{})
- func (s *ZapLogger) Errorw(msg string, keyvals ...interface{})
- func (s *ZapLogger) Fatal(a ...interface{})
- func (s *ZapLogger) Fatalf(format string, a ...interface{})
- func (s *ZapLogger) Fatalw(msg string, keyvals ...interface{})
- func (s *ZapLogger) Info(a ...interface{})
- func (s *ZapLogger) Infof(format string, a ...interface{})
- func (s *ZapLogger) Infow(msg string, keyvals ...interface{})
- func (s *ZapLogger) Log(level log.Level, keyvals ...interface{}) error
- func (s *ZapLogger) LogRoundTrip(req *http.Request, res *http.Response, err error, start time.Time, ...) error
- func (s *ZapLogger) Printf(format string, args ...interface{})
- func (s *ZapLogger) Println(a ...interface{})
- func (s *ZapLogger) RequestBodyEnabled() bool
- func (s *ZapLogger) ResponseBodyEnabled() bool
- func (s *ZapLogger) Warn(a ...interface{})
- func (s *ZapLogger) Warnf(format string, a ...interface{})
- func (s *ZapLogger) Warnw(msg string, keyvals ...interface{})
- type ZapLoggerEx
Constants ¶
This section is empty.
Variables ¶
var DefaultLogger = NewLogger(std.NewStdCore(zapcore.DebugLevel), 1)
DefaultLogger is default logger.
var File_log_conf_proto protoreflect.FileDescriptor
Functions ¶
Types ¶
type Conf ¶
type Conf struct { Console *StdoutConf `protobuf:"bytes,1,opt,name=console,proto3" json:"console,omitempty"` File *FileConf `protobuf:"bytes,2,opt,name=file,proto3" json:"file,omitempty"` Fluent *FluentConf `protobuf:"bytes,3,opt,name=fluent,proto3" json:"fluent,omitempty"` // contains filtered or unexported fields }
func (*Conf) Descriptor
deprecated
func (*Conf) GetConsole ¶
func (x *Conf) GetConsole() *StdoutConf
func (*Conf) GetFluent ¶
func (x *Conf) GetFluent() *FluentConf
func (*Conf) ProtoMessage ¶
func (*Conf) ProtoMessage()
func (*Conf) ProtoReflect ¶
func (x *Conf) ProtoReflect() protoreflect.Message
func (*Conf) Validate ¶
Validate checks the field values on Conf with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*Conf) ValidateAll ¶ added in v0.0.8
ValidateAll checks the field values on Conf with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ConfMultiError, or nil if none found.
type ConfMultiError ¶ added in v0.0.8
type ConfMultiError []error
ConfMultiError is an error wrapping multiple validation errors returned by Conf.ValidateAll() if the designated constraints aren't met.
func (ConfMultiError) AllErrors ¶ added in v0.0.8
func (m ConfMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (ConfMultiError) Error ¶ added in v0.0.8
func (m ConfMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type ConfValidationError ¶
type ConfValidationError struct {
// contains filtered or unexported fields
}
ConfValidationError is the validation error returned by Conf.Validate if the designated constraints aren't met.
func (ConfValidationError) Cause ¶
func (e ConfValidationError) Cause() error
Cause function returns cause value.
func (ConfValidationError) Error ¶
func (e ConfValidationError) Error() string
Error satisfies the builtin error interface
func (ConfValidationError) ErrorName ¶
func (e ConfValidationError) ErrorName() string
ErrorName returns error name.
func (ConfValidationError) Field ¶
func (e ConfValidationError) Field() string
Field function returns field value.
func (ConfValidationError) Key ¶
func (e ConfValidationError) Key() bool
Key function returns key value.
func (ConfValidationError) Reason ¶
func (e ConfValidationError) Reason() string
Reason function returns reason value.
type FileConf ¶
type FileConf struct { Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"` Level int32 `protobuf:"varint,2,opt,name=level,proto3" json:"level,omitempty"` Path string `protobuf:"bytes,3,opt,name=path,proto3" json:"path,omitempty"` Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
func (*FileConf) Descriptor
deprecated
func (*FileConf) ProtoMessage ¶
func (*FileConf) ProtoMessage()
func (*FileConf) ProtoReflect ¶
func (x *FileConf) ProtoReflect() protoreflect.Message
func (*FileConf) Validate ¶
Validate checks the field values on FileConf with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*FileConf) ValidateAll ¶ added in v0.0.8
ValidateAll checks the field values on FileConf with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in FileConfMultiError, or nil if none found.
type FileConfMultiError ¶ added in v0.0.8
type FileConfMultiError []error
FileConfMultiError is an error wrapping multiple validation errors returned by FileConf.ValidateAll() if the designated constraints aren't met.
func (FileConfMultiError) AllErrors ¶ added in v0.0.8
func (m FileConfMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (FileConfMultiError) Error ¶ added in v0.0.8
func (m FileConfMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type FileConfValidationError ¶
type FileConfValidationError struct {
// contains filtered or unexported fields
}
FileConfValidationError is the validation error returned by FileConf.Validate if the designated constraints aren't met.
func (FileConfValidationError) Cause ¶
func (e FileConfValidationError) Cause() error
Cause function returns cause value.
func (FileConfValidationError) Error ¶
func (e FileConfValidationError) Error() string
Error satisfies the builtin error interface
func (FileConfValidationError) ErrorName ¶
func (e FileConfValidationError) ErrorName() string
ErrorName returns error name.
func (FileConfValidationError) Field ¶
func (e FileConfValidationError) Field() string
Field function returns field value.
func (FileConfValidationError) Key ¶
func (e FileConfValidationError) Key() bool
Key function returns key value.
func (FileConfValidationError) Reason ¶
func (e FileConfValidationError) Reason() string
Reason function returns reason value.
type FluentConf ¶
type FluentConf struct { Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"` Level int32 `protobuf:"varint,2,opt,name=level,proto3" json:"level,omitempty"` Addr string `protobuf:"bytes,3,opt,name=addr,proto3" json:"addr,omitempty"` // contains filtered or unexported fields }
func (*FluentConf) Descriptor
deprecated
func (*FluentConf) Descriptor() ([]byte, []int)
Deprecated: Use FluentConf.ProtoReflect.Descriptor instead.
func (*FluentConf) GetAddr ¶
func (x *FluentConf) GetAddr() string
func (*FluentConf) GetEnable ¶
func (x *FluentConf) GetEnable() bool
func (*FluentConf) GetLevel ¶
func (x *FluentConf) GetLevel() int32
func (*FluentConf) ProtoMessage ¶
func (*FluentConf) ProtoMessage()
func (*FluentConf) ProtoReflect ¶
func (x *FluentConf) ProtoReflect() protoreflect.Message
func (*FluentConf) Reset ¶
func (x *FluentConf) Reset()
func (*FluentConf) String ¶
func (x *FluentConf) String() string
func (*FluentConf) Validate ¶
func (m *FluentConf) Validate() error
Validate checks the field values on FluentConf with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*FluentConf) ValidateAll ¶ added in v0.0.8
func (m *FluentConf) ValidateAll() error
ValidateAll checks the field values on FluentConf with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in FluentConfMultiError, or nil if none found.
type FluentConfMultiError ¶ added in v0.0.8
type FluentConfMultiError []error
FluentConfMultiError is an error wrapping multiple validation errors returned by FluentConf.ValidateAll() if the designated constraints aren't met.
func (FluentConfMultiError) AllErrors ¶ added in v0.0.8
func (m FluentConfMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (FluentConfMultiError) Error ¶ added in v0.0.8
func (m FluentConfMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type FluentConfValidationError ¶
type FluentConfValidationError struct {
// contains filtered or unexported fields
}
FluentConfValidationError is the validation error returned by FluentConf.Validate if the designated constraints aren't met.
func (FluentConfValidationError) Cause ¶
func (e FluentConfValidationError) Cause() error
Cause function returns cause value.
func (FluentConfValidationError) Error ¶
func (e FluentConfValidationError) Error() string
Error satisfies the builtin error interface
func (FluentConfValidationError) ErrorName ¶
func (e FluentConfValidationError) ErrorName() string
ErrorName returns error name.
func (FluentConfValidationError) Field ¶
func (e FluentConfValidationError) Field() string
Field function returns field value.
func (FluentConfValidationError) Key ¶
func (e FluentConfValidationError) Key() bool
Key function returns key value.
func (FluentConfValidationError) Reason ¶
func (e FluentConfValidationError) Reason() string
Reason function returns reason value.
type StdoutConf ¶
type StdoutConf struct { Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"` Level int32 `protobuf:"varint,2,opt,name=level,proto3" json:"level,omitempty"` // contains filtered or unexported fields }
func (*StdoutConf) Descriptor
deprecated
func (*StdoutConf) Descriptor() ([]byte, []int)
Deprecated: Use StdoutConf.ProtoReflect.Descriptor instead.
func (*StdoutConf) GetEnable ¶
func (x *StdoutConf) GetEnable() bool
func (*StdoutConf) GetLevel ¶
func (x *StdoutConf) GetLevel() int32
func (*StdoutConf) ProtoMessage ¶
func (*StdoutConf) ProtoMessage()
func (*StdoutConf) ProtoReflect ¶
func (x *StdoutConf) ProtoReflect() protoreflect.Message
func (*StdoutConf) Reset ¶
func (x *StdoutConf) Reset()
func (*StdoutConf) String ¶
func (x *StdoutConf) String() string
func (*StdoutConf) Validate ¶
func (m *StdoutConf) Validate() error
Validate checks the field values on StdoutConf with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.
func (*StdoutConf) ValidateAll ¶ added in v0.0.8
func (m *StdoutConf) ValidateAll() error
ValidateAll checks the field values on StdoutConf with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in StdoutConfMultiError, or nil if none found.
type StdoutConfMultiError ¶ added in v0.0.8
type StdoutConfMultiError []error
StdoutConfMultiError is an error wrapping multiple validation errors returned by StdoutConf.ValidateAll() if the designated constraints aren't met.
func (StdoutConfMultiError) AllErrors ¶ added in v0.0.8
func (m StdoutConfMultiError) AllErrors() []error
AllErrors returns a list of validation violation errors.
func (StdoutConfMultiError) Error ¶ added in v0.0.8
func (m StdoutConfMultiError) Error() string
Error returns a concatenation of all the error messages it wraps.
type StdoutConfValidationError ¶
type StdoutConfValidationError struct {
// contains filtered or unexported fields
}
StdoutConfValidationError is the validation error returned by StdoutConf.Validate if the designated constraints aren't met.
func (StdoutConfValidationError) Cause ¶
func (e StdoutConfValidationError) Cause() error
Cause function returns cause value.
func (StdoutConfValidationError) Error ¶
func (e StdoutConfValidationError) Error() string
Error satisfies the builtin error interface
func (StdoutConfValidationError) ErrorName ¶
func (e StdoutConfValidationError) ErrorName() string
ErrorName returns error name.
func (StdoutConfValidationError) Field ¶
func (e StdoutConfValidationError) Field() string
Field function returns field value.
func (StdoutConfValidationError) Key ¶
func (e StdoutConfValidationError) Key() bool
Key function returns key value.
func (StdoutConfValidationError) Reason ¶
func (e StdoutConfValidationError) Reason() string
Reason function returns reason value.
type ZapLogger ¶
type ZapLogger struct {
// contains filtered or unexported fields
}
func GetLogger ¶
func GetLogger() *ZapLogger
GetLogger returns global logger appliance as logger in current process.
func (*ZapLogger) Debug ¶
func (s *ZapLogger) Debug(a ...interface{})
Debug logs a message at debug level.
func (*ZapLogger) Error ¶
func (s *ZapLogger) Error(a ...interface{})
Error logs a message at error level.
func (*ZapLogger) Fatal ¶
func (s *ZapLogger) Fatal(a ...interface{})
Fatal logs a message at fatal level.
func (*ZapLogger) Info ¶
func (s *ZapLogger) Info(a ...interface{})
Info logs a message at info level.
func (*ZapLogger) LogRoundTrip ¶
func (s *ZapLogger) LogRoundTrip( req *http.Request, res *http.Response, err error, start time.Time, dur time.Duration, ) error
LogRoundTrip prints the information about request and response.
func (*ZapLogger) RequestBodyEnabled ¶
RequestBodyEnabled makes the client pass request body to logger
func (*ZapLogger) ResponseBodyEnabled ¶
RequestBodyEnabled makes the client pass response body to logger
func (*ZapLogger) Warn ¶
func (s *ZapLogger) Warn(a ...interface{})
Warn logs a message at warn level.
type ZapLoggerEx ¶
type ZapLoggerEx struct {
ZapLogger
}
func NewZapLoggerEx ¶
func NewZapLoggerEx(core zapcore.Core) *ZapLoggerEx
func (*ZapLoggerEx) Error ¶
func (s *ZapLoggerEx) Error(err error, msg string, keysAndValues ...interface{})
Error logs an error condition.
func (*ZapLoggerEx) Info ¶
func (s *ZapLoggerEx) Info(msg string, keysAndValues ...interface{})