log

package
v0.1.0-alpha-5 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefault

func SetDefault(l *Wrapper)

SetDefault sets the default Logger.

Types

type Severity

type Severity int

Severity of the log message.

const (
	// Default means that the log entry has no assigned severity level.
	Default Severity = iota * 100
	// Debug or trace information.
	Debug
	// Info events are routine information, such as ongoing status or performance.
	Info
	// Notice are normal but significant events, such as start up, shut down, or a configuration change.
	Notice
	// Warning events might cause problems.
	Warning
	// Error events are likely to cause problems.
	Error
	// Critical events cause more severe problems or outages.
	Critical
	// Alert events mean that a person must take an action immediately.
	Alert
	// Emergency means that one or more systems are unusable.
	Emergency
)

func ParseSeverity

func ParseSeverity(value string) Severity

ParseSeverity parses a string value into a Severity.

func (Severity) String

func (s Severity) String() string

type Wrapper

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

Wrapper writes application log entries.

func Get

func Get() *Wrapper

Get returns the default singleton Logger.

func New

func New(writer Writer) *Wrapper

New creates a new Logger.

func (*Wrapper) Alert

func (w *Wrapper) Alert(msg string, err error)

Alert writes an alert log entry.

func (*Wrapper) AlertData

func (w *Wrapper) AlertData(msg string, err error, data interface{})

AlertData writes alert logs with additional structured data.

func (*Wrapper) Critical

func (w *Wrapper) Critical(msg string, err error)

Critical writes a critical log entry.

func (*Wrapper) CriticalData

func (w *Wrapper) CriticalData(msg string, err error, data interface{})

CriticalData writes critical logs with additional structured data.

func (*Wrapper) Debug

func (w *Wrapper) Debug(msg string)

Debug writes a debug log entry.

func (*Wrapper) DebugData

func (w *Wrapper) DebugData(msg string, data interface{})

DebugData writes debug logs with additional structured data.

func (*Wrapper) DebugF

func (w *Wrapper) DebugF(format string, args ...interface{})

DebugF writes a formatted debug log entry.

func (*Wrapper) Emergency

func (w *Wrapper) Emergency(msg string, err error)

Emergency writes an emergency log entry.

func (*Wrapper) EmergencyData

func (w *Wrapper) EmergencyData(msg string, err error, data interface{})

EmergencyData writes emergency logs with additional structured data.

func (*Wrapper) Error

func (w *Wrapper) Error(msg string, err error)

Error writes an error log entry.

func (*Wrapper) ErrorData

func (w *Wrapper) ErrorData(msg string, err error, data interface{})

ErrorData writes error logs with additional structured data.

func (*Wrapper) Info

func (w *Wrapper) Info(msg string)

Info writes an info log entry.

func (*Wrapper) InfoData

func (w *Wrapper) InfoData(msg string, data interface{})

InfoData writes info logs with additional structured data.

func (*Wrapper) InfoF

func (w *Wrapper) InfoF(format string, args ...interface{})

InfoF writes a formatted info log entry.

func (*Wrapper) Notice

func (w *Wrapper) Notice(msg string)

Notice writes a notice log entry.

func (*Wrapper) NoticeData

func (w *Wrapper) NoticeData(msg string, data interface{})

NoticeData writes notice logs with additional structured data.

func (*Wrapper) NoticeF

func (w *Wrapper) NoticeF(format string, args ...interface{})

NoticeF writes a formatted notice log entry.

func (*Wrapper) Warning

func (w *Wrapper) Warning(msg string)

Warning writes a warning log entry.

func (*Wrapper) WarningData

func (w *Wrapper) WarningData(msg string, data interface{})

WarningData writes warning logs with additional structured data.

func (*Wrapper) WarningF

func (w *Wrapper) WarningF(format string, args ...interface{})

WarningF writes a formatted warning log entry.

func (*Wrapper) Writer

func (w *Wrapper) Writer() Writer

Writer returns the underlying log writer.

type Writer

type Writer interface {
	CreateLogEntry(severity Severity, msg string, err error, data interface{}) string
	WriteLog(severity Severity, msg string, err error, data interface{})
	AddHTTPRequest(req *http.Request) Writer
	AddRequestID(requestID string) Writer
}

Writer writes application log entries

Jump to

Keyboard shortcuts

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