log

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf

func Debugf(template string, args ...interface{})

func Debugw

func Debugw(msg string, keysAndValues ...interface{})

func Errorf

func Errorf(template string, args ...interface{})

func Errorw

func Errorw(msg string, keysAndValues ...interface{})

func Fatalf

func Fatalf(template string, args ...interface{})

func Fatalw

func Fatalw(msg string, keysAndValues ...interface{})

func Infof

func Infof(template string, args ...interface{})

func Infow

func Infow(msg string, keysAndValues ...interface{})

func Panicf

func Panicf(template string, args ...interface{})

func Panicw

func Panicw(msg string, keysAndValues ...interface{})

func RegisterLogger

func RegisterLogger(options *Options)

RegisterLogger register global logger.

func Sync

func Sync()

Sync ...

func Warnf

func Warnf(template string, args ...interface{})

func Warnw

func Warnw(msg string, keysAndValues ...interface{})

Types

type Logger

type Logger interface {
	Debugf(template string, args ...interface{})
	Infof(template string, args ...interface{})
	Warnf(template string, args ...interface{})
	Errorf(template string, args ...interface{})
	Panicf(template string, args ...interface{})
	Fatalf(template string, args ...interface{})

	Debugw(msg string, keysAndValues ...interface{})
	Infow(msg string, keysAndValues ...interface{})
	Warnw(msg string, keysAndValues ...interface{})
	Errorw(msg string, keysAndValues ...interface{})
	Panicw(msg string, keysAndValues ...interface{})
	Fatalw(msg string, keysAndValues ...interface{})

	Sync()
}

func NewLogger

func NewLogger(opts *Options) Logger

NewLogger new a logger.

type Options

type Options struct {
	Level      string `json:"level" mapstructure:"level"`
	OutputPath string `json:"output-path" mapstructure:"output-path,omitempty"`
	MaxSize    int    `json:"max-size" mapstructure:"max-size,omitempty"`
	MaxBackups int    `json:"max-backups" mapstructure:"max-backups,omitempty"`
	MaxAge     int    `json:"max-age" mapstructure:"max-age,omitempty"`
	Compress   bool   `json:"compress" mapstructure:"compress,omitempty"`
	MessageKey string `json:"message-key" mapstructure:"message-key,omitempty"`
	LevelKey   string `json:"level-key" mapstructure:"level-key,omitempty"`
	CallerKey  string `json:"caller-key" mapstructure:"caller-key,omitempty"`
	TimeKey    string `json:"time-key" mapstructure:"time-key,omitempty"`
}

func NewOptions

func NewOptions() *Options

NewOptions new a log option.

func (*Options) AddFlags

func (o *Options) AddFlags(fs *pflag.FlagSet)

func (*Options) Validate

func (o *Options) Validate() error

Validate validate log options is valid.

Jump to

Keyboard shortcuts

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