log

package
v1.7.11 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DebugSeverity indicates a debug logging message
	DebugSeverity severity = iota
	// InfoSeverity indicates an informational logging message
	InfoSeverity
	// WarnSeverity indicates a warning logging message
	WarnSeverity
	// ErrorSeverity indicates a critical severity logging message
	ErrorSeverity
	// PanicSeverity indicates a severity logging message that is unliekly to be
	// recovered from
	PanicSeverity
)

Variables

This section is empty.

Functions

func New

func New(isDebug bool) log_api.Logger

New method instantiates a new logger that we can write things to.

func NewForService

func NewForService(serviceName string, isDebug bool) log_api.Logger

NewForService method instantiates a new logger that includes information about the service itself.

func NewWithOptions

func NewWithOptions(outputBuffer io.Writer, prefix string, isDebug bool) log_api.Logger

NewWithOptions method instantiates a new logger with all configurable options. This specific constructor is not intended to be used directly by clients.

Types

type Logger

type Logger struct {
	BackingLogger *stdlib_log.Logger
	IsDebug       bool
	// contains filtered or unexported fields
}

Logger is the main logging object that can be used to log messages to stdout or any other io.Writer. Delegates to `log.Logger` for writing to the buffer.

func (*Logger) CopyWith

func (logger *Logger) CopyWith(prefix string, isDebug bool) log_api.Logger

CopyWith creates a copy of the logger with the prefix and debug values overridden by the arguments.

func (*Logger) Debug

func (logger *Logger) Debug(args ...interface{})

Debug prints to stdout a debug-level logging message. Alias of Debugln method.

func (*Logger) DebugEnabled

func (logger *Logger) DebugEnabled() bool

DebugEnabled returns if the debug logging should be displayed for a particular logger instance

func (*Logger) Debugf

func (logger *Logger) Debugf(format string, args ...interface{})

Debugf prints to stdout a formatted debug-level logging message

func (*Logger) Debugln

func (logger *Logger) Debugln(args ...interface{})

Debugln prints to stdout a debug-level logging message

func (*Logger) Error

func (logger *Logger) Error(args ...interface{})

Error prints to stdout a error-level logging message. Alias of Errorn method.

func (*Logger) Errorf

func (logger *Logger) Errorf(format string, args ...interface{})

Errorf prints to stdout a formatted error-level logging message

func (*Logger) Errorln

func (logger *Logger) Errorln(args ...interface{})

Errorln prints to stdout a error-level logging message

func (*Logger) Info

func (logger *Logger) Info(args ...interface{})

Info prints to stdout a info-level logging message. Alias of Infoln method.

func (*Logger) Infof

func (logger *Logger) Infof(format string, args ...interface{})

Infof prints to stdout a formatted info-level logging message

func (*Logger) Infoln

func (logger *Logger) Infoln(args ...interface{})

Infoln prints to stdout a info-level logging message

func (*Logger) Panic

func (logger *Logger) Panic(args ...interface{})

Panic prints to stdout a panic-level logging message. Alias of Panicln method.

func (*Logger) Panicf

func (logger *Logger) Panicf(format string, args ...interface{})

Panicf prints to stdout a formatted panic-level logging message

func (*Logger) Panicln

func (logger *Logger) Panicln(args ...interface{})

Panicln prints to stdout a panic-level logging message

func (*Logger) Prefix

func (logger *Logger) Prefix() string

Prefix returns the prefix that will be prepended to all output messages

func (*Logger) Warn

func (logger *Logger) Warn(args ...interface{})

Warn prints to stdout a warning-level logging message. Alias of Warnln method.

func (*Logger) Warnf

func (logger *Logger) Warnf(format string, args ...interface{})

Warnf prints to stdout a formatted warning-level logging message

func (*Logger) Warnln

func (logger *Logger) Warnln(args ...interface{})

Warnln prints to stdout a warning-level logging message

Jump to

Keyboard shortcuts

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