Documentation
¶
Index ¶
- func ReplaceGlobals(logger *zap.Logger) func()
- type ZapBuilder
- func (b *ZapBuilder) Build() *zap.Logger
- func (b *ZapBuilder) CallerSkip(callerSkip int) *ZapBuilder
- func (b *ZapBuilder) JSONFormatConsole() *ZapBuilder
- func (b *ZapBuilder) JSONFormatFile() *ZapBuilder
- func (b *ZapBuilder) Level(logLevel zapcore.Level) *ZapBuilder
- func (b *ZapBuilder) LogPath(logPath string) *ZapBuilder
- func (b *ZapBuilder) MaxKeepDays(maxKeepDays int) *ZapBuilder
- func (b *ZapBuilder) MaxLogSize(maxLogSize int) *ZapBuilder
- func (b *ZapBuilder) NoCaller() *ZapBuilder
- func (b *ZapBuilder) NoColors() *ZapBuilder
- func (b *ZapBuilder) NoConsole() *ZapBuilder
- func (b *ZapBuilder) NoErrSeparate() *ZapBuilder
- func (b *ZapBuilder) NoLogFile() *ZapBuilder
- func (b *ZapBuilder) NoTimestamp() *ZapBuilder
- func (b *ZapBuilder) StacktraceLevel(stacktraceLevel zapcore.Level) *ZapBuilder
- func (b *ZapBuilder) TimeLocation(timeLocation *time.Location) *ZapBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReplaceGlobals ¶
ReplaceGlobals replaces the global Logger and SugaredLogger, and returns a function to restore the original values. It's safe for concurrent use.
Types ¶
type ZapBuilder ¶
type ZapBuilder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func NewBuilder() *ZapBuilder
func (*ZapBuilder) Build ¶
func (b *ZapBuilder) Build() *zap.Logger
func (*ZapBuilder) CallerSkip ¶
func (b *ZapBuilder) CallerSkip(callerSkip int) *ZapBuilder
CallerSkip sets the caller skip.
CallerSkip increases the number of callers skipped by caller annotation (as enabled by the AddCaller option). When building wrappers around the Logger and SugaredLogger, supplying this Option prevents zap from always reporting the wrapper code as the caller.
func (*ZapBuilder) JSONFormatConsole ¶
func (b *ZapBuilder) JSONFormatConsole() *ZapBuilder
func (*ZapBuilder) JSONFormatFile ¶
func (b *ZapBuilder) JSONFormatFile() *ZapBuilder
func (*ZapBuilder) Level ¶
func (b *ZapBuilder) Level(logLevel zapcore.Level) *ZapBuilder
Level sets the log level.
func (*ZapBuilder) LogPath ¶ added in v0.4.0
func (b *ZapBuilder) LogPath(logPath string) *ZapBuilder
func (*ZapBuilder) MaxKeepDays ¶
func (b *ZapBuilder) MaxKeepDays(maxKeepDays int) *ZapBuilder
MaxKeepDays sets the maximum retention days for logs.
func (*ZapBuilder) MaxLogSize ¶
func (b *ZapBuilder) MaxLogSize(maxLogSize int) *ZapBuilder
MaxLogSize sets the maximum size in megabytes of the log file before it gets rotated. It defaults to 100 megabytes.
func (*ZapBuilder) NoCaller ¶
func (b *ZapBuilder) NoCaller() *ZapBuilder
func (*ZapBuilder) NoColors ¶
func (b *ZapBuilder) NoColors() *ZapBuilder
func (*ZapBuilder) NoConsole ¶
func (b *ZapBuilder) NoConsole() *ZapBuilder
func (*ZapBuilder) NoErrSeparate ¶
func (b *ZapBuilder) NoErrSeparate() *ZapBuilder
func (*ZapBuilder) NoLogFile ¶
func (b *ZapBuilder) NoLogFile() *ZapBuilder
func (*ZapBuilder) NoTimestamp ¶
func (b *ZapBuilder) NoTimestamp() *ZapBuilder
func (*ZapBuilder) StacktraceLevel ¶
func (b *ZapBuilder) StacktraceLevel(stacktraceLevel zapcore.Level) *ZapBuilder
StacktraceLevel sets the stacktrace level.
func (*ZapBuilder) TimeLocation ¶
func (b *ZapBuilder) TimeLocation(timeLocation *time.Location) *ZapBuilder
TimeLocation sets the time zone.