zap

package
v0.0.0-...-f66ea8c Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(service string, options ...Option) *zap.SugaredLogger

Types

type Option

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

func WithDebug

func WithDebug() Option

WithDebug returns an Option to configure the Logger for a debug environment. When this option is set: 1. Log files will not be saved locally. 2. Log messages will be output to the terminal. 3. The log level will be set to Debug. This is useful to ensure that unit tests do not produce persistent log files and provide verbose logging output for debugging.

func WithLevel

func WithLevel(lvl log.Level) Option

WithLevel returns an Option to set the logging level for the Logger. The provided lvl will determine the verbosity of logging output.

func WithLogFileAge

func WithLogFileAge(age int) Option

WithLogFileAge returns an Option to set the maximum age for the Logger's log files. The provided age is in days and determines the maximum number of days a log file is retained. If age is set to 0, log files will not be deleted based on age.

func WithLogFileSize

func WithLogFileSize(size int) Option

WithLogFileSize returns an Option to set the maximum file size for the Logger's log files. The provided size is in MiB (Mebibytes) and determines the maximum size a log file can grow before it gets rotated.

func WithLogPath

func WithLogPath(path string) Option

WithLogPath returns an Option to set the directory path where the Logger's log files will be saved. The provided path determines the destination folder for all log files created by the Logger.

func WithLogWriter

func WithLogWriter(writer io.Writer) Option

Jump to

Keyboard shortcuts

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