zlog

package
v0.0.0-...-e951cd5 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	// contains filtered or unexported fields
}

func NewChannel

func NewChannel(name string, opts ...*Options) *Channel

func (*Channel) GetLevel

func (c *Channel) GetLevel() log.Level

func (*Channel) GetLogger

func (c *Channel) GetLogger() log.Logger

func (*Channel) GetName

func (c *Channel) GetName() string

func (*Channel) GetOutput

func (c *Channel) GetOutput() Output

func (*Channel) GetPersistentKV

func (c *Channel) GetPersistentKV() []interface{}

func (*Channel) Level

func (c *Channel) Level(level log.Level) *Channel

func (*Channel) NewLogger

func (c *Channel) NewLogger(kvs ...interface{}) log.Logger

func (*Channel) Option

func (c *Channel) Option(opts *Options) *Channel

func (*Channel) Output

func (c *Channel) Output(o Output) *Channel

func (*Channel) PersistentKV

func (c *Channel) PersistentKV(kvs ...interface{}) *Channel

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(defaultChannelName string, opts ...ManagerOption) *Manager

func (*Manager) AddChannel

func (m *Manager) AddChannel(names ...string)

func (*Manager) Get

func (m *Manager) Get(names ...string) log.Logger

func (*Manager) Reassign

func (m *Manager) Reassign()

func (*Manager) SetLevel

func (m *Manager) SetLevel(level log.Level) *Manager

func (*Manager) SetOption

func (m *Manager) SetOption(opts *Options) *Manager

func (*Manager) SetOutput

func (m *Manager) SetOutput(output Output) *Manager

func (*Manager) SetPersistentKV

func (m *Manager) SetPersistentKV(kvs ...interface{}) *Manager

type ManagerOption

type ManagerOption func(m *Manager)

func WithChannelOption

func WithChannelOption(opts *Options) ManagerOption

func WithLevel

func WithLevel(level log.Level) ManagerOption

func WithOutput

func WithOutput(output Output) ManagerOption

func WithPersistentKV

func WithPersistentKV(kvs ...interface{}) ManagerOption

type Options

type Options struct {
	Directory string
	// default: log
	Ext string
	// MaxAge is the maximum number of days to retain old log files based on the
	// timestamp encoded in their filename.  Note that a day is defined as 24
	// hours and may not exactly correspond to calendar days due to daylight
	// savings, leap seconds, etc. The default is not to remove old log files
	// based on age.
	MaxAge int
	// MaxSize is the maximum size in megabytes of the log file before it gets rotated.
	// It defaults to 100 megabytes. unit: megabytes
	MaxSize int
	// MaxBackups is the maximum number of old log files to retain. The default is to retain all old log files
	MaxBackups int
	// Compress determines if the rotated log files should be compressed using gzip.
	// The default is not to perform compression.
	Compress bool
}

type Output

type Output int8
const (
	Stderr Output = iota
	Stdout
	File
)

func ParseOutput

func ParseOutput(s string) Output

func (Output) String

func (o Output) String() string

Jump to

Keyboard shortcuts

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