log

package
v0.0.0-...-fd3ce3a Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AppendNL indicates that a forced '\n' is added.
	AppendNL byte = 1
)

Variables

This section is empty.

Functions

func DisableFiles

func DisableFiles()

DisableFiles flushes and closes current logs files, and disables output to files.

func EnableFiles

func EnableFiles()

EnableFiles flushes current logs to files, and enables output to files.

Types

type Entry

type Entry struct {
	Time  time.Time
	Taint Taint
	Data  []byte
}

func (*Entry) ReadFrom

func (e *Entry) ReadFrom(r io.Reader) (n int64, err error)

ReadFrom reads the next entry from r, updating this entry.

func (Entry) WriteTo

func (e Entry) WriteTo(w io.Writer) (n int64, err error)

WriteTo writes this log entry to w. Automatically appends a new line if it's not already present to get an easy to read log.

type Log

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

Log is a log target

func Get

func Get(name string) *Log

func (*Log) Print

func (l *Log) Print(v ...interface{})

Print to this log.

func (*Log) Printf

func (l *Log) Printf(pattern string, v ...interface{})

Printf to this log.

func (*Log) SetConsole

func (l *Log) SetConsole(console io.Writer)

func (*Log) StreamLines

func (l *Log) StreamLines(r io.Reader)

StreamLines will copy the input line by line as log entries.

func (*Log) Taint

func (l *Log) Taint(taint Taint, v ...interface{})

Taint is Print to this log with a taint.

func (*Log) Taintf

func (l *Log) Taintf(taint Taint, pattern string, v ...interface{})

Taintf is Printf to this log with a taint.

func (*Log) Write

func (l *Log) Write(b []byte) (n int, err error)

Write is part of the io.Writer interface.

type Taint

type Taint byte
const (
	Normal Taint = iota
	Info
	Warning
	Error
	Fatal
	OK
)

func (Taint) Color

func (t Taint) Color() color.Color

Jump to

Keyboard shortcuts

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