console

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColorFormatter

type ColorFormatter struct {
}

ColorFormatter implements the "Formatter" interface nad generated colored console output

func (ColorFormatter) Format

func (f ColorFormatter) Format(e entry.Entry) string

Format formats an entry

type Formatter

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

Formatter defines the interface for formatting entries for console output

type Option

type Option func(w *Writer)

Option is the console-writer option type

func WithFormatter

func WithFormatter(f Formatter) Option

WithFormatter configures the console writer to use the provided Formatter

func WithStream

func WithStream(s io.WriteCloser) Option

WithStream configures the console writer to use the provided io.Writer

type TextFormatter

type TextFormatter struct{}

func (TextFormatter) Format

func (f TextFormatter) Format(e entry.Entry) string

type Writer

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

Writer is the standard console writer and implements the log.Writer interface

func NewWriter

func NewWriter(opts ...Option) *Writer

NewWriter creates a new console-writer with the provided options

func (*Writer) Close

func (w *Writer) Close()

Close closes the Writer

func (*Writer) Write

func (w *Writer) Write(e entry.Entry)

Write writes a log.Entry to the writer stream

Jump to

Keyboard shortcuts

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