logging

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package logging defines the minimal interface that loggers must support to be used by pack.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInfoErrorWriter added in v0.5.0

func GetInfoErrorWriter(l Logger) io.Writer

GetInfoErrorWriter will return an ErrorWriter, typically stderr if one exists, otherwise the standard logger writer will be returned.

func GetInfoWriter added in v0.5.0

func GetInfoWriter(l Logger) io.Writer

GetInfoWriter returns a writer See WithInfoWriter

func Tip added in v0.3.0

func Tip(l Logger, format string, v ...interface{})

Tip logs a tip.

Types

type Logger

type Logger interface {
	Debug(msg string)
	Debugf(fmt string, v ...interface{})

	Info(msg string)
	Infof(fmt string, v ...interface{})

	Warn(msg string)
	Warnf(fmt string, v ...interface{})

	Error(msg string)
	Errorf(fmt string, v ...interface{})

	Writer() io.Writer

	IsVerbose() bool
}

Logger defines behavior required by a logging package used by pack libraries

func New added in v0.3.0

func New(w io.Writer) Logger

New creates a default logger for the pack library. Note that the pack CLI has it's own logger.

type PrefixWriter added in v0.3.0

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

PrefixWriter will prefix writes

func NewPrefixWriter added in v0.3.0

func NewPrefixWriter(w io.Writer, prefix string) *PrefixWriter

NewPrefixWriter writes by w will be prefixed

func (*PrefixWriter) Write added in v0.3.0

func (w *PrefixWriter) Write(buf []byte) (int, error)

Writes bytes to the embedded log function

type WithInfoErrorWriter added in v0.5.0

type WithInfoErrorWriter interface {
	InfoErrorWriter() io.Writer
}

WithInfoErrorWriter is an optional interface for loggers that want to support a separate writer for errors and standard logging. the DebugInfoWriter should write to stderr if quiet is false.

type WithInfoWriter added in v0.5.0

type WithInfoWriter interface {
	InfoWriter() io.Writer
}

WithInfoWriter is an optional interface what will return a writer that will write raw output if quiet is false.

Jump to

Keyboard shortcuts

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