log

package
v3.10.0-0.45.0+incompa... Latest Latest
Warning

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

Go to latest
Published: May 15, 2018 License: Apache-2.0 Imports: 11 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 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) ErrorsSeen

func (l *Logger) ErrorsSeen() bool

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()

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