console

package module
v0.0.0-...-e59009b Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NONE  = 0
	LEVEL = 1 << iota
	TIME
	FILE
)

Variables

This section is empty.

Functions

func AssertError

func AssertError(v ...interface{})

func Debug

func Debug(v ...interface{})

func Debugf

func Debugf(format string, v ...interface{})

func Error

func Error(v ...interface{})

func Errorf

func Errorf(format string, v ...interface{})

func Exit

func Exit(v interface{})

func Info

func Info(v ...interface{})

func Infof

func Infof(format string, v ...interface{})

func NewJsonFormatter

func NewJsonFormatter() *jsonFormatter

func NewTextFormatter

func NewTextFormatter() *textFormatter

func OneLine

func OneLine(format string, v ...interface{})

func Printf

func Printf(format string, v ...interface{})

func Println

func Println(v ...interface{})

func SetColor

func SetColor(flag bool)

func SetFlags

func SetFlags(flags int)

func SetFormatter

func SetFormatter(formatter Formatter)

func SetHook

func SetHook(hook Hook)

func SetLogger

func SetLogger(logger *Logger)

func Warning

func Warning(v ...interface{})

func Warningf

func Warningf(format string, v ...interface{})

Types

type Color

type Color int
const (
	Reset Color = iota
	Bold
	Faint
	Italic
	Underline
	BlinkSlow
	BlinkRapid
	ReverseVideo
	Concealed
	CrossedOut
)

Base colors -- attributes in reality

const (
	FgBlack Color = iota + 30
	FgRed
	FgGreen
	FgYellow
	FgBlue
	FgMagenta
	FgCyan
	FgWhite
)

Foreground colors

const (
	FgHiBlack Color = iota + 90
	FgHiRed
	FgHiGreen
	FgHiYellow
	FgHiBlue
	FgHiMagenta
	FgHiCyan
	FgHiWhite
)

Foreground Hi-Intensity colors

const (
	BgBlack Color = iota + 40
	BgRed
	BgGreen
	BgYellow
	BgBlue
	BgMagenta
	BgCyan
	BgWhite
)

Background colors

const (
	BgHiBlack Color = iota + 100
	BgHiRed
	BgHiGreen
	BgHiYellow
	BgHiBlue
	BgHiMagenta
	BgHiCyan
	BgHiWhite
)

Background Hi-Intensity colors

func (Color) Printf

func (c Color) Printf(format string, v ...interface{})

func (Color) Println

func (c Color) Println(v ...interface{})

type Entry

type Entry struct {
	Level  Level
	File   string
	Line   int
	Time   time.Time
	Format string
	Args   []interface{}
}

type Formatter

type Formatter interface {
	Format(entry *Entry) string
}

type Hook

type Hook interface {
	Fire(entry *Entry)
}

type Level

type Level string
const (
	ERR Level = "ERR"
	INF Level = "INF"
	DEB Level = "DEB"
	WAR Level = "WAR"
)

type Logger

type Logger struct {
	Hook      Hook
	Formatter Formatter
	Flags     int
	Color     bool
}

func NewLogger

func NewLogger() *Logger

func (*Logger) Debug

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

func (*Logger) Debugf

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

func (*Logger) Error

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

func (*Logger) Errorf

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

func (*Logger) Info

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

func (*Logger) Infof

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

func (*Logger) SetColor

func (log *Logger) SetColor(flag bool)

func (*Logger) SetFlags

func (log *Logger) SetFlags(flags int)

func (*Logger) SetFormatter

func (log *Logger) SetFormatter(formatter Formatter)

func (*Logger) SetHook

func (log *Logger) SetHook(hook Hook)

func (*Logger) Warning

func (log *Logger) Warning(args ...interface{})

func (*Logger) Warningf

func (log *Logger) Warningf(format string, args ...interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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