zaplog

package
v0.0.0-...-41bfbcf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...LoggerOption) *zap.Logger

New creates a zap.Logger with LoggerOption.

Types

type LoggerOption

type LoggerOption interface {
	// contains filtered or unexported methods
}

A LoggerOption sets options such as filename, etc.

func WithFileName

func WithFileName(fn string) LoggerOption

WithFileName returns a LoggerOption that sets filename for logger. Note: Default it uses /tmp/zap-logger.log.

func WithMaxAge

func WithMaxAge(maxAge int) LoggerOption

WithMaxAge returns a LoggerOption that sets maxAge for logger. MaxAge is the maximum number of days to retain old log files based on the timestamp encoded in their filename. Note: Default it uses 7 days.

func WithMaxBackups

func WithMaxBackups(maxBackups int) LoggerOption

WithMaxBackups returns a LoggerOption that sets maxBackups for logger. MaxBackups is the maximum number of old log files to retain. Note: Default it uses 3 .

func WithMaxSize

func WithMaxSize(maxSize int) LoggerOption

WithMaxSize returns a LoggerOption that sets maxSize for logger. MaxSize is the maximum size in megabytes of the log file before it gets rotated. Note: Default it uses 500 megabytes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL