Documentation ¶
Index ¶
- Constants
- Variables
- func Debug(args ...interface{})
- func Debugf(template string, args ...interface{})
- func DurationToMilliseconds(duration time.Duration) float32
- func Error(args ...interface{})
- func Errorf(template string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(template string, args ...interface{})
- func Info(args ...interface{})
- func Infof(template string, args ...interface{})
- func LogAndReturnError(err error) error
- func Set(logger Logger)
- func SetLogValue(m map[string]interface{}, key string, val interface{})
- func Setup(config Config)
- func Warn(args ...interface{})
- func Warnf(template string, args ...interface{})
- type Config
- type DTLSLogger
- func (l DTLSLogger) Debug(msg string)
- func (l DTLSLogger) Debugf(format string, args ...interface{})
- func (l DTLSLogger) Error(msg string)
- func (l DTLSLogger) Errorf(format string, args ...interface{})
- func (l DTLSLogger) Info(msg string)
- func (l DTLSLogger) Infof(format string, args ...interface{})
- func (l DTLSLogger) Trace(msg string)
- func (l DTLSLogger) Tracef(format string, args ...interface{})
- func (l DTLSLogger) Warn(msg string)
- func (l DTLSLogger) Warnf(format string, args ...interface{})
- type DTLSLoggerFactory
- type EncoderConfig
- type EpochMillisTimeEncoder
- type EpochNanosTimeEncoder
- type EpochTimeEncoder
- type ISO8601TimeEncoder
- type Logger
- type RFC3339NanoTimeEncoder
- type RFC3339TimeEncoder
- type StacktraceConfig
- type TimeEncoder
- type TimeEncoderWrapper
- type WrapSuggarLogger
- func (l *WrapSuggarLogger) Check(lvl zapcore.Level) bool
- func (l *WrapSuggarLogger) Config() Config
- func (l *WrapSuggarLogger) DTLSLoggerFactory() logging.LoggerFactory
- func (l *WrapSuggarLogger) Debug(args ...interface{})
- func (l *WrapSuggarLogger) Debugf(template string, args ...interface{})
- func (l *WrapSuggarLogger) Error(args ...interface{})
- func (l *WrapSuggarLogger) Errorf(template string, args ...interface{})
- func (l *WrapSuggarLogger) Fatal(args ...interface{})
- func (l *WrapSuggarLogger) Fatalf(template string, args ...interface{})
- func (l *WrapSuggarLogger) GetLogFunc(lvl zapcore.Level) func(args ...interface{})
- func (l *WrapSuggarLogger) Info(args ...interface{})
- func (l *WrapSuggarLogger) Infof(template string, args ...interface{})
- func (l *WrapSuggarLogger) LogAndReturnError(err error) error
- func (l *WrapSuggarLogger) PreProcessArgs(args ...interface{}) *WrapSuggarLogger
- func (l *WrapSuggarLogger) Unwrap() interface{}
- func (l *WrapSuggarLogger) Warn(args ...interface{})
- func (l *WrapSuggarLogger) Warnf(template string, args ...interface{})
- func (l *WrapSuggarLogger) With(args ...interface{}) Logger
Constants ¶
View Source
const ( // DebugLevel logs are typically voluminous, and are usually disabled in // production. DebugLevel = zap.DebugLevel // InfoLevel is the default logging priority. InfoLevel = zap.InfoLevel // WarnLevel logs are more important than Info, but don't need individual // human review. WarnLevel = zap.WarnLevel // ErrorLevel logs are high-priority. If an application is running smoothly, // it shouldn't generate any error-level logs. ErrorLevel = zap.ErrorLevel // DPanicLevel logs are particularly important errors. In development the // logger panics after writing the message. DPanicLevel = zap.DPanicLevel // PanicLevel logs a message, then panics. PanicLevel = zap.PanicLevel // FatalLevel logs a message, then calls os.Exit(1). FatalLevel = zap.FatalLevel )
Variables ¶
View Source
var ( CorrelationIDKey = "correlationId" DeviceIDKey = "deviceId" ResourceHrefKey = "href" CommandFilterKey = "commandFilter" DeviceIDFilterKey = "deviceIdFilter" ResourceIDFilterKey = "resourceIdFilter" TypeFilterKey = "typeFilter" EventFilterKey = "eventFilter" SubActionKey = "subscriptionAction" PlgdKey = "plgd" JWTKey = "jwt" SubKey = "sub" RequestKey = "request" ResponseKey = "response" StartTimeKey = "startTime" DeadlineKey = "deadline" MethodKey = "method" ProtocolKey = "protocol" BodyKey = "body" DurationMSKey = "durationMs" ErrorKey = "error" X509Key = "x509" TraceIDKey = "traceId" MessageKey = "message" SubjectsKey = "subjects" CertManagerKey = "certManager" )
Functions ¶
func Debugf ¶
func Debugf(template string, args ...interface{})
Debugf uses fmt.Sprintf to log a templated message.
func DurationToMilliseconds ¶ added in v2.2.4
func Errorf ¶
func Errorf(template string, args ...interface{})
Errorf uses fmt.Sprintf to log a templated message.
func Fatal ¶
func Fatal(args ...interface{})
Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.
func Fatalf ¶
func Fatalf(template string, args ...interface{})
Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.
func Infof ¶
func Infof(template string, args ...interface{})
Infof uses fmt.Sprintf to log a templated message.
func LogAndReturnError ¶
func SetLogValue ¶ added in v2.2.4
Types ¶
type Config ¶
type Config struct { // Level is the minimum enabled logging level. Note that this is a dynamic // level, so calling Config.Level.SetLevel will atomically change the log // level of all loggers descended from this config. Level zapcore.Level `json:"level" yaml:"level"` // Encoding sets the logger's encoding. Valid values are "json" (default) and // "console", as well as any third-party encodings registered via // RegisterEncoder. Encoding string `json:"encoding" yaml:"encoding"` Stacktrace StacktraceConfig `json:"stacktrace" yaml:"stacktrace"` // An EncoderConfig allows users to configure the concrete encoders supplied by // zapcore. EncoderConfig EncoderConfig `json:"encoderConfig" yaml:"encoderConfig"` // DumpBody if true, dump request/response/stream body to log. DumpBody bool `json:"dumpBody" yaml:"dumpBody"` }
Config configuration for setup logging.
func MakeDefaultConfig ¶ added in v2.2.4
func MakeDefaultConfig() Config
type DTLSLogger ¶ added in v2.6.0
type DTLSLogger struct {
// contains filtered or unexported fields
}
func (DTLSLogger) Debug ¶ added in v2.6.0
func (l DTLSLogger) Debug(msg string)
func (DTLSLogger) Debugf ¶ added in v2.6.0
func (l DTLSLogger) Debugf(format string, args ...interface{})
func (DTLSLogger) Error ¶ added in v2.6.0
func (l DTLSLogger) Error(msg string)
func (DTLSLogger) Errorf ¶ added in v2.6.0
func (l DTLSLogger) Errorf(format string, args ...interface{})
func (DTLSLogger) Info ¶ added in v2.6.0
func (l DTLSLogger) Info(msg string)
func (DTLSLogger) Infof ¶ added in v2.6.0
func (l DTLSLogger) Infof(format string, args ...interface{})
func (DTLSLogger) Trace ¶ added in v2.6.0
func (l DTLSLogger) Trace(msg string)
func (DTLSLogger) Tracef ¶ added in v2.6.0
func (l DTLSLogger) Tracef(format string, args ...interface{})
func (DTLSLogger) Warn ¶ added in v2.6.0
func (l DTLSLogger) Warn(msg string)
func (DTLSLogger) Warnf ¶ added in v2.6.0
func (l DTLSLogger) Warnf(format string, args ...interface{})
type DTLSLoggerFactory ¶ added in v2.6.0
type DTLSLoggerFactory struct {
// contains filtered or unexported fields
}
func (DTLSLoggerFactory) NewLogger ¶ added in v2.6.0
func (f DTLSLoggerFactory) NewLogger(scope string) logging.LeveledLogger
type EncoderConfig ¶ added in v2.2.4
type EncoderConfig struct {
EncodeTime TimeEncoderWrapper `json:"timeEncoder" yaml:"timeEncoder"`
}
type EpochMillisTimeEncoder ¶ added in v2.2.4
type EpochMillisTimeEncoder struct{}
func (EpochMillisTimeEncoder) Encode ¶ added in v2.2.4
func (e EpochMillisTimeEncoder) Encode(t time.Time, enc zapcore.PrimitiveArrayEncoder)
func (EpochMillisTimeEncoder) String ¶ added in v2.2.4
func (e EpochMillisTimeEncoder) String() string
func (EpochMillisTimeEncoder) TimeString ¶ added in v2.2.4
func (e EpochMillisTimeEncoder) TimeString() string
type EpochNanosTimeEncoder ¶ added in v2.2.4
type EpochNanosTimeEncoder struct{}
func (EpochNanosTimeEncoder) Encode ¶ added in v2.2.4
func (e EpochNanosTimeEncoder) Encode(t time.Time, enc zapcore.PrimitiveArrayEncoder)
func (EpochNanosTimeEncoder) String ¶ added in v2.2.4
func (e EpochNanosTimeEncoder) String() string
func (EpochNanosTimeEncoder) TimeString ¶ added in v2.2.4
func (e EpochNanosTimeEncoder) TimeString() string
type EpochTimeEncoder ¶ added in v2.2.4
type EpochTimeEncoder struct{}
func (EpochTimeEncoder) Encode ¶ added in v2.2.4
func (e EpochTimeEncoder) Encode(t time.Time, enc zapcore.PrimitiveArrayEncoder)
func (EpochTimeEncoder) String ¶ added in v2.2.4
func (e EpochTimeEncoder) String() string
func (EpochTimeEncoder) TimeString ¶ added in v2.2.4
func (e EpochTimeEncoder) TimeString() string
type ISO8601TimeEncoder ¶ added in v2.2.4
type ISO8601TimeEncoder struct{}
func (ISO8601TimeEncoder) Encode ¶ added in v2.2.4
func (e ISO8601TimeEncoder) Encode(t time.Time, enc zapcore.PrimitiveArrayEncoder)
func (ISO8601TimeEncoder) String ¶ added in v2.2.4
func (e ISO8601TimeEncoder) String() string
func (ISO8601TimeEncoder) TimeString ¶ added in v2.2.4
func (e ISO8601TimeEncoder) TimeString() string
type Logger ¶
type Logger interface { Debug(args ...interface{}) Info(args ...interface{}) Warn(args ...interface{}) Error(args ...interface{}) Fatal(args ...interface{}) Debugf(template string, args ...interface{}) Infof(template string, args ...interface{}) Warnf(template string, args ...interface{}) Errorf(template string, args ...interface{}) Fatalf(template string, args ...interface{}) With(args ...interface{}) Logger Unwrap() interface{} LogAndReturnError(err error) error Config() Config Check(lvl zapcore.Level) bool GetLogFunc(lvl zapcore.Level) func(args ...interface{}) DTLSLoggerFactory() logging.LoggerFactory }
type RFC3339NanoTimeEncoder ¶ added in v2.2.4
type RFC3339NanoTimeEncoder struct{}
func (RFC3339NanoTimeEncoder) Encode ¶ added in v2.2.4
func (e RFC3339NanoTimeEncoder) Encode(t time.Time, enc zapcore.PrimitiveArrayEncoder)
func (RFC3339NanoTimeEncoder) String ¶ added in v2.2.4
func (e RFC3339NanoTimeEncoder) String() string
func (RFC3339NanoTimeEncoder) TimeString ¶ added in v2.2.4
func (e RFC3339NanoTimeEncoder) TimeString() string
type RFC3339TimeEncoder ¶ added in v2.2.4
type RFC3339TimeEncoder struct{}
func (RFC3339TimeEncoder) Encode ¶ added in v2.2.4
func (e RFC3339TimeEncoder) Encode(t time.Time, enc zapcore.PrimitiveArrayEncoder)
func (RFC3339TimeEncoder) String ¶ added in v2.2.4
func (e RFC3339TimeEncoder) String() string
func (RFC3339TimeEncoder) TimeString ¶ added in v2.2.4
func (e RFC3339TimeEncoder) TimeString() string
type StacktraceConfig ¶ added in v2.2.4
type StacktraceConfig struct { Enabled bool `yaml:"enabled" json:"enabled" description:"enable stacktrace"` Level zapcore.Level `json:"level" yaml:"level" description:"from level"` }
func (*StacktraceConfig) Validate ¶ added in v2.2.4
func (c *StacktraceConfig) Validate() error
type TimeEncoder ¶ added in v2.2.4
type TimeEncoderWrapper ¶ added in v2.2.4
type TimeEncoderWrapper struct {
TimeEncoder TimeEncoder
}
func (TimeEncoderWrapper) MarshalText ¶ added in v2.2.4
func (t TimeEncoderWrapper) MarshalText() ([]byte, error)
func (*TimeEncoderWrapper) UnmarshalText ¶ added in v2.2.4
func (t *TimeEncoderWrapper) UnmarshalText(text []byte) error
type WrapSuggarLogger ¶ added in v2.3.9
type WrapSuggarLogger struct {
// contains filtered or unexported fields
}
func (*WrapSuggarLogger) Check ¶ added in v2.3.9
func (l *WrapSuggarLogger) Check(lvl zapcore.Level) bool
func (*WrapSuggarLogger) Config ¶ added in v2.3.9
func (l *WrapSuggarLogger) Config() Config
func (*WrapSuggarLogger) DTLSLoggerFactory ¶ added in v2.6.0
func (l *WrapSuggarLogger) DTLSLoggerFactory() logging.LoggerFactory
func (*WrapSuggarLogger) Debug ¶ added in v2.3.9
func (l *WrapSuggarLogger) Debug(args ...interface{})
func (*WrapSuggarLogger) Debugf ¶ added in v2.3.9
func (l *WrapSuggarLogger) Debugf(template string, args ...interface{})
func (*WrapSuggarLogger) Error ¶ added in v2.3.9
func (l *WrapSuggarLogger) Error(args ...interface{})
func (*WrapSuggarLogger) Errorf ¶ added in v2.3.9
func (l *WrapSuggarLogger) Errorf(template string, args ...interface{})
Errorf uses fmt.Sprintf to log a templated message.
func (*WrapSuggarLogger) Fatal ¶ added in v2.3.9
func (l *WrapSuggarLogger) Fatal(args ...interface{})
func (*WrapSuggarLogger) Fatalf ¶ added in v2.3.9
func (l *WrapSuggarLogger) Fatalf(template string, args ...interface{})
func (*WrapSuggarLogger) GetLogFunc ¶ added in v2.7.5
func (l *WrapSuggarLogger) GetLogFunc(lvl zapcore.Level) func(args ...interface{})
func (*WrapSuggarLogger) Info ¶ added in v2.3.9
func (l *WrapSuggarLogger) Info(args ...interface{})
func (*WrapSuggarLogger) Infof ¶ added in v2.3.9
func (l *WrapSuggarLogger) Infof(template string, args ...interface{})
func (*WrapSuggarLogger) LogAndReturnError ¶ added in v2.3.9
func (l *WrapSuggarLogger) LogAndReturnError(err error) error
func (*WrapSuggarLogger) PreProcessArgs ¶ added in v2.5.0
func (l *WrapSuggarLogger) PreProcessArgs(args ...interface{}) *WrapSuggarLogger
func (*WrapSuggarLogger) Unwrap ¶ added in v2.3.9
func (l *WrapSuggarLogger) Unwrap() interface{}
func (*WrapSuggarLogger) Warn ¶ added in v2.3.9
func (l *WrapSuggarLogger) Warn(args ...interface{})
func (*WrapSuggarLogger) Warnf ¶ added in v2.3.9
func (l *WrapSuggarLogger) Warnf(template string, args ...interface{})
func (*WrapSuggarLogger) With ¶ added in v2.3.9
func (l *WrapSuggarLogger) With(args ...interface{}) Logger
Click to show internal directories.
Click to hide internal directories.