Documentation
¶
Index ¶
- type Caller
- type Core
- type Err
- type Level
- type Option
- type Rotation
- type SentryConfig
- type TimeFormat
- type Zap
- func (z *Zap) DPanic(args ...any)
- func (z *Zap) DPanicF(message string, args ...any)
- func (z *Zap) DPanicW(message string, keyAndValues ...any)
- func (z *Zap) Debug(args ...any)
- func (z *Zap) DebugF(message string, args ...any)
- func (z *Zap) DebugW(message string, keyAndValues ...any)
- func (z *Zap) Error(args ...any)
- func (z *Zap) ErrorF(message string, args ...any)
- func (z *Zap) ErrorW(message string, keyAndValues ...any)
- func (z *Zap) Fatal(args ...any)
- func (z *Zap) FatalF(message string, args ...any)
- func (z *Zap) FatalW(message string, keyAndValues ...any)
- func (z *Zap) Info(args ...any)
- func (z *Zap) InfoF(message string, args ...any)
- func (z *Zap) InfoW(message string, keyAndValues ...any)
- func (z *Zap) NewCore(cores ...Core) error
- func (z *Zap) Panic(args ...any)
- func (z *Zap) PanicF(message string, args ...any)
- func (z *Zap) PanicW(message string, keyAndValues ...any)
- func (z *Zap) Warn(args ...any)
- func (z *Zap) WarnF(message string, args ...any)
- func (z *Zap) WarnW(message string, keyAndValues ...any)
- type Zapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Caller ¶
type Caller interface {
Debug(...any)
DebugF(string, ...any)
DebugW(string, ...any)
Info(...any)
InfoF(string, ...any)
InfoW(string, ...any)
Warn(...any)
WarnF(string, ...any)
WarnW(string, ...any)
Error(...any)
ErrorF(string, ...any)
ErrorW(string, ...any)
DPanic(...any)
DPanicF(string, ...any)
DPanicW(string, ...any)
Panic(...any)
PanicF(string, ...any)
PanicW(string, ...any)
Fatal(...any)
FatalF(string, ...any)
FatalW(string, ...any)
}
type Core ¶
type Core interface {
// contains filtered or unexported methods
}
Core zapper base abstract
func ConsoleWriterCore ¶
ConsoleWriterCore create console writer for zapper to show log in console
func SentryCore ¶
func SentryCore(dsn string, serverName string, cfg *SentryConfig) Core
SentryCore send log into sentry service
type Level ¶
Level zapper levels
const ( Debug Level = iota // Debug logs are typically voluminous, and are usually disabled in production Info // Info is the default logging priority Warn // Warn logs are more important than Info, but don't need individual human review Error // Error logs are high-priority. If an application is running smoothly, it shouldn't generate any error-level logs DPanic // DPanic logs are particularly important errors. In development the logger panics after writing the message Panic // Panic logs a message, then panics Fatal // Fatal logs a message, then calls os.Exit(1) )
type Option ¶
type Option func(*Zap)
func WithCustomStackTraceLevel ¶
WithCustomStackTraceLevel set custom level for show stacktrace, min level warn
func WithTimeFormat ¶
func WithTimeFormat(format TimeFormat) Option
WithTimeFormat set custom time format for zapper logs
type SentryConfig ¶
type SentryConfig struct {
AttachStacktrace bool
Debug bool
EnableTracing bool
Environment string
Dist string
EnableBreadcrumbs bool
BreadcrumbLevel Level
MaxBreadcrumbs int
MaxSpans int
Tags map[string]string
MinLevel Level
}
SentryConfig for sentry core set custom configs
type TimeFormat ¶
type TimeFormat int
TimeFormat set custom time format for zap log
const ( ISO8601 TimeFormat = iota // ISO8601 serializes a time.Time to an ISO8601-formatted string with millisecond precision RFC3339 // RFC3339 serializes a time.Time to an RFC3339-formatted string RFC3339NANO // RFC3339NANO serializes a time.Time to an RFC3339-formatted string with nanosecond precision )
func (TimeFormat) String ¶
func (i TimeFormat) String() string
type Zap ¶
type Zap struct {
// contains filtered or unexported fields
}
func (*Zap) DPanic ¶
DPanic uses fmt.Sprint to construct and log a message. In development, the logger then panics. (See DPanicLevel for details.)
func (*Zap) DPanicF ¶
DPanicF uses fmt.Sprintf to log a templated message. In development, the logger then panics. (See DPanicLevel for details.)
func (*Zap) DPanicW ¶
DPanicW logs a message with some additional context. In development, the logger then panics. (See DPanicLevel for details.) The variadic key-value pairs are treated as they are in With
func (*Zap) DebugW ¶
DebugW logs a message with some additional context. The variadic key-value pairs are treated as they are in With.
When debug-level logging is disabled, this is much faster than
s.With(keysAndValues).Debug(msg)
func (*Zap) ErrorW ¶
ErrorW logs a message with some additional context. The variadic key-value pairs are treated as they are in With
func (*Zap) FatalW ¶
FatalW logs a message with some additional context, then calls os.Exit. The variadic key-value pairs are treated as they are in With
func (*Zap) InfoW ¶
InfoW logs a message with some additional context. The variadic key-value pairs are treated as they are in With
func (*Zap) PanicW ¶
PanicW logs a message with some additional context, then panics. The variadic key-value pairs are treated as they are in With