Documentation ¶
Index ¶
- Variables
- func Create(c *Conf) (core.Logger, error)
- 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 MustCreate(c *Conf) core.Logger
- func Register(name string, factory Factory)
- func SetLogger(logger *ZapLogger)
- func Warn(a ...interface{})
- func Warnf(format string, a ...interface{})
- func Warnw(msg string, keyvals ...interface{})
- func WithCore(c zapcore.Core, kv ...interface{}) zapcore.Core
- type Conf
- func (*Conf) Descriptor() ([]byte, []int)deprecated
- func (x *Conf) GetEndpoint() string
- func (x *Conf) GetKey() string
- func (x *Conf) GetLevel() int32
- func (x *Conf) GetLogGroupName() string
- func (x *Conf) GetPath() string
- func (x *Conf) GetProfile() string
- func (x *Conf) GetRegion() string
- func (x *Conf) GetSecret() string
- func (x *Conf) GetType() CoreType
- 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 CoreType
- type Factory
- type Registry
- 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{})
- func (s *ZapLogger) With(kv ...interface{}) *ZapLogger
- type ZapLoggerEx
Constants ¶
This section is empty.
Variables ¶
var ( CoreType_name = map[int32]string{ 0: "Unkown", 1: "Stdout", 2: "File", 3: "Fluent", 4: "CloudWatch", 5: "AliYun", 6: "Sys", 7: "Hc", } CoreType_value = map[string]int32{ "Unkown": 0, "Stdout": 1, "File": 2, "Fluent": 3, "CloudWatch": 4, "AliYun": 5, "Sys": 6, "Hc": 7, } )
Enum value maps for CoreType.
var File_log_conf_proto protoreflect.FileDescriptor
Functions ¶
func MustCreate ¶ added in v0.0.36
MustCreate instantiates a cores based on `discoveryDSN`.
Types ¶
type Conf ¶
type Conf struct { Type CoreType `protobuf:"varint,1,opt,name=type,proto3,enum=log.CoreType" json:"type,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"` Endpoint string `protobuf:"bytes,4,opt,name=endpoint,proto3" json:"endpoint,omitempty"` Key string `protobuf:"bytes,5,opt,name=key,proto3" json:"key,omitempty"` Secret string `protobuf:"bytes,6,opt,name=secret,proto3" json:"secret,omitempty"` Region string `protobuf:"bytes,7,opt,name=region,proto3" json:"region,omitempty"` Profile string `protobuf:"bytes,8,opt,name=profile,proto3" json:"profile,omitempty"` LogGroupName string `protobuf:"bytes,9,opt,name=logGroupName,proto3" json:"logGroupName,omitempty"` // contains filtered or unexported fields }
func (*Conf) Descriptor
deprecated
func (*Conf) GetEndpoint ¶ added in v0.0.36
func (*Conf) GetLogGroupName ¶ added in v0.0.36
func (*Conf) GetProfile ¶ added in v0.0.36
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 CoreType ¶ added in v0.0.36
type CoreType int32
func (CoreType) Descriptor ¶ added in v0.0.36
func (CoreType) Descriptor() protoreflect.EnumDescriptor
func (CoreType) EnumDescriptor
deprecated
added in
v0.0.36
func (CoreType) Number ¶ added in v0.0.36
func (x CoreType) Number() protoreflect.EnumNumber
func (CoreType) Type ¶ added in v0.0.36
func (CoreType) Type() protoreflect.EnumType
type Registry ¶ added in v0.0.36
type Registry interface { Register(name string, factory Factory) Create(c *Conf) (core.Logger, error) }
Registry is the interface for callers to get registered middleware.
func NewRegistry ¶ added in v0.0.36
func NewRegistry() Registry
NewRegistry returns a new middleware registry.
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 ¶
ResponseBodyEnabled 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{})