logger

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
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 = "truncate"
	// FileModeRotate will enable log rotation for log files.
	FileModeRotate = "rotate"
)
View Source
const (
	TypeFile      Type = "file"
	TypeWaterfall      = "waterfall"
	TypeTee            = "tee"
)

Variables

This section is empty.

Functions

func NewCore added in v0.9.0

func NewCore(conf Config) (zapcore.Core, error)

func NewWaterfall added in v0.9.0

func NewWaterfall(cores ...zapcore.Core) zapcore.Core

NewWaterfall creates a new core that distributes logs to the underlying cores in a waterfall pattern; for each log entry the core will iterate through each core, in order, stopping when it finds a core that will accept the log entry.

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"`
	Name  string        `yaml:"name"`
	Level zapcore.Level `yaml:"level"`
	// Type specifies how log entries are handled. If Type is Waterfall or Tee
	// this will distribute log entries to child loggers; fields Mode, Name,
	// and Level will be ignored. If the value is Sink or empty the Children
	// field will be ignored.
	Type Type `yaml:"type,omitempty"`
	// Specifies underlying children loggers. Only applicable when Type is
	// TypeWaterfall or TypeTee.
	Children []Config `yaml:"children,omitempty"`
}

type FileMode

type FileMode string

func (*FileMode) UnmarshalYAML

func (m *FileMode) UnmarshalYAML(node *yaml.Node) error

type Type added in v0.9.0

type Type string

Jump to

Keyboard shortcuts

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