Documentation ¶
Overview ¶
Package logging defines the minimal interface that loggers must support to be used by pack.
Index ¶
- func GetWriterForLevel(logger Logger, level Level) io.Writer
- func IsQuiet(logger Logger) bool
- func ScanLinesKeepNewLine(data []byte, atEOF bool) (advance int, token []byte, err error)
- func Tip(l Logger, format string, v ...interface{})
- type Level
- type Logger
- type PrefixWriter
- type PrefixWriterOption
- type WithSelectableWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetWriterForLevel ¶ added in v0.7.0
GetWriterForLevel retrieves the appropriate Writer for the log level provided.
See WithSelectableWriter
func ScanLinesKeepNewLine ¶ added in v0.14.1
A customized implementation of bufio.ScanLines that preserves new line characters.
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
type PrefixWriter ¶
type PrefixWriter struct {
// contains filtered or unexported fields
}
PrefixWriter is a buffering writer that prefixes each new line. Close should be called to properly flush the buffer.
func NewPrefixWriter ¶
func NewPrefixWriter(w io.Writer, prefix string, opts ...PrefixWriterOption) *PrefixWriter
NewPrefixWriter writes by w will be prefixed
func (*PrefixWriter) Close ¶ added in v0.14.1
func (w *PrefixWriter) Close() error
Close writes any pending data in the buffer
type PrefixWriterOption ¶ added in v0.14.2
type PrefixWriterOption func(c *PrefixWriter)
func WithReaderFactory ¶ added in v0.14.2
func WithReaderFactory(factory func(data []byte) io.Reader) PrefixWriterOption
type WithSelectableWriter ¶ added in v0.7.0
WithSelectableWriter is an optional interface for loggers that want to support a separate writer per log level.