log

package
v2.20.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QuotedCmd

func QuotedCmd(cmd *exec.Cmd) string

QuotedCmd returns a concatenated, quoted form of cmd's cmdline

Types

type Logger

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

Logger implements a variadic flavor of log/syslog.Writer

func New

func New(logToStdout bool) Logger

New creates a new logger. If logToStdout is true, syslog is tried first. If syslog fails or logToStdout is false Stdout is used.

func (Logger) Alert

func (l Logger) Alert(format string, a ...interface{})

Alert logs a message at alert priority.

func (Logger) Close

func (l Logger) Close()

Close closes the logger.

func (Logger) Crit

func (l Logger) Crit(format string, a ...interface{})

Crit logs a message at critical priority.

func (Logger) Debug

func (l Logger) Debug(format string, a ...interface{})

Debug logs a message at debug priority.

func (Logger) Emerg

func (l Logger) Emerg(format string, a ...interface{})

Emerg logs a message at emergency priority.

func (Logger) Err

func (l Logger) Err(format string, a ...interface{})

Err logs a message at error priority.

func (Logger) Info

func (l Logger) Info(format string, a ...interface{})

Info logs a message at info priority.

func (*Logger) LogCmd

func (l *Logger) LogCmd(cmd *exec.Cmd, format string, a ...interface{}) (int, error)

LogCmd runs and logs the supplied cmd as an operation with distinct start/finish/fail log messages uniformly combined with the supplied format string. The exact command path and arguments being executed are also logged for debugging assistance.

func (*Logger) LogOp

func (l *Logger) LogOp(op func() error, format string, a ...interface{}) error

LogOp calls and logs the supplied function as an operation with distinct start/finish/fail log messages uniformly combined with the supplied format string.

func (Logger) LogReport added in v2.14.0

func (l Logger) LogReport(r report.Report)

LogReport logs entries from the report at appropriate levels.

func (Logger) Notice

func (l Logger) Notice(format string, a ...interface{})

Notice logs a message at notice priority.

func (*Logger) PopPrefix

func (l *Logger) PopPrefix()

PopPrefix pops the top entry from the Logger's prefix stack. The prefix stack is concatenated in FIFO order and prefixed to the start of every message logged via Logger.

func (*Logger) PushPrefix

func (l *Logger) PushPrefix(format string, a ...interface{})

PushPrefix pushes the supplied message onto the Logger's prefix stack. The prefix stack is concatenated in FIFO order and prefixed to the start of every message logged via Logger.

func (Logger) Warning

func (l Logger) Warning(format string, a ...interface{})

Warning logs a message at warning priority.

type LoggerOps

type LoggerOps interface {
	Emerg(string) error
	Alert(string) error
	Crit(string) error
	Err(string) error
	Warning(string) error
	Notice(string) error
	Info(string) error
	Debug(string) error
	Close() error
}

type Stdout

type Stdout struct{}

func (Stdout) Alert

func (Stdout) Alert(msg string) error

func (Stdout) Close

func (Stdout) Close() error

func (Stdout) Crit

func (Stdout) Crit(msg string) error

func (Stdout) Debug

func (Stdout) Debug(msg string) error

func (Stdout) Emerg

func (Stdout) Emerg(msg string) error

func (Stdout) Err

func (Stdout) Err(msg string) error

func (Stdout) Info

func (Stdout) Info(msg string) error

func (Stdout) Notice

func (Stdout) Notice(msg string) error

func (Stdout) Warning

func (Stdout) Warning(msg string) error

Jump to

Keyboard shortcuts

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