logger

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New added in v1.3.0

func New(conf Config) (*zap.Logger, error)

func OpenFile

func OpenFile(path string, mode FileMode) (zapcore.WriteSyncer, error)

Types

type Config

type Config struct {
	Path string `yaml:"path"`
	// If Path is a file, Mode will determine how the log file is managed.
	// FileModeAppend is the default if value is undefined.
	Mode    FileMode      `yaml:"mode,omitempty"`
	Level   zapcore.Level `yaml:"level"`
	DevMode bool          `yaml:"devmode"`
}

type FileMode

type FileMode string
const (
	// FileModeAppend will append to existing log files between restarts.
	// This is the default option.
	FileModeAppend FileMode = "append"
	// FileModeTruncate will truncate onto existing log files in between
	// restarts.
	FileModeTruncate FileMode = "truncate"
	// FileModeRotate will enable log rotation for log files.
	FileModeRotate FileMode = "rotate"
)

func (*FileMode) Set

func (m *FileMode) Set(s string) error

func (FileMode) String

func (m FileMode) String() string

Jump to

Keyboard shortcuts

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