logger

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(options LogOptions) error

func NewFileHook

func NewFileHook(filePath string) (logrus.Hook, error)

Types

type Formatter

type Formatter struct {
	// DisableColor disable colors
	DisableColor bool
	// HideLogTime if send to remote log system that already adds timestamps.
	HideLogTime bool
	// HideLogPath more simple log message without file and lines
	HideLogPath     bool
	TimestampFormat string
}

func (*Formatter) Format

func (f *Formatter) Format(entry *logrus.Entry) ([]byte, error)

type LogOptions

type LogOptions struct {
	// sealer log file path, default log directory is `/var/lib/sealer/log`
	OutputPath string
	// Verbose: sealer log level,if it is ture will set debug log mode.
	Verbose bool
	// DisableColor if true will disable outputting colors.
	DisableColor         bool
	RemoteLoggerURL      string
	RemoteLoggerTaskName string
	// LogToFile flag represent whether write log to disk, default is false.
	LogToFile bool
}

type RemoteLogHook

type RemoteLogHook struct {
	sync.RWMutex

	TaskName string
	URL      string
}

RemoteLogHook to send logs via remote URL.

func NewRemoteLogHook

func NewRemoteLogHook(remoteURL, taskName string) (*RemoteLogHook, error)

func (*RemoteLogHook) Fire

func (hook *RemoteLogHook) Fire(entry *logrus.Entry) error

func (*RemoteLogHook) Levels

func (hook *RemoteLogHook) Levels() []logrus.Level

Jump to

Keyboard shortcuts

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