log

package
v3.8.0-alpha.1+incompa... Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2017 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorLevel  = Level{4, "error", "ERROR: ", ct.Red, true}   // Something is definitely wrong
	WarnLevel   = Level{3, "warn", "WARN:  ", ct.Yellow, true} // Likely to be an issue but maybe not
	NoticeLevel = Level{2, "note", "[Note] ", ct.White, false} // Introductory / summary
	InfoLevel   = Level{1, "info", "Info:  ", ct.None, false}  // Just informational
	DebugLevel  = Level{0, "debug", "debug: ", ct.None, false} // Extra verbose
)

Functions

func EvalTemplate

func EvalTemplate(id string, template string, data map[string]interface{}) string

func IsTerminal

func IsTerminal(w io.Writer) bool

cribbed a la "github.com/openshift/origin/pkg/cmd/util"

func LimitLines

func LimitLines(msg string, n int) string

turn excess lines into [...]

Types

type Entry

type Entry struct {
	ID      string
	Origin  string
	Level   Level
	Message string
}

type Hash

type Hash map[string]interface{} // convenience/cosmetic type

type Level

type Level struct {
	Level  int
	Name   string
	Prefix string
	Color  ct.Color
	Bright bool
}

type Logger

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

func NewLogger

func NewLogger(setLevel int, setFormat string, out io.Writer) (*Logger, error)

func (*Logger) Debug

func (l *Logger) Debug(id string, text string)

func (*Logger) Error

func (l *Logger) Error(id string, text string)

Convenience functions

func (*Logger) Info

func (l *Logger) Info(id string, text string)

func (*Logger) LogEntry

func (l *Logger) LogEntry(entry Entry)

func (*Logger) Notice

func (l *Logger) Notice(id string, text string)

func (*Logger) Summary

func (l *Logger) Summary(warningsSeen int, errorsSeen int)

Provide a summary at the end

func (*Logger) Warn

func (l *Logger) Warn(id string, text string)

type LoggerOptions

type LoggerOptions struct {
	Level  int
	Format string
	Out    io.Writer
}

func (*LoggerOptions) NewLogger

func (o *LoggerOptions) NewLogger() (*Logger, error)

Jump to

Keyboard shortcuts

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