logs

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decorator

type Decorator interface {
	// Get the unique name for a subsystem for the specified scope
	Subsystem(scope, name string) string
	// Get the prefix for a line
	LinePrefix(context LineContext) string
	// Get the suffix for a line
	LineSuffix(context LineContext) string
}

func NewDefaultDecorator

func NewDefaultDecorator(marker, prefixTemplate string) Decorator

type LineContext

type LineContext struct {
	// The scope of the current line
	Scope string

	// This line is interrupting a previous line
	Interrupting bool
	// The scope of the interrupted previous line
	InterruptedScope string

	// This line is going to be interrupted by the next line
	Interrupted bool
	// The scope of the interrupting next line
	InterruptingScope string
}

type LogWriter

type LogWriter interface {
	io.Writer
	io.StringWriter
	Printer
	Subsystem(name string) LogWriter
}

func New

func New(target io.Writer, name string) LogWriter

func NewDecorated

func NewDecorated(target io.Writer, name string, decorator Decorator) LogWriter

type Printer

type Printer interface {
	Print(a ...any) (int, error)
	Printf(format string, a ...any) (int, error)
	Println(values ...any) (int, error)
}

type ScopeWriter

type ScopeWriter interface {
	GetScope(scope string, name string) string
	WriteScope(scope string, b []byte) (int, error)
}

Jump to

Keyboard shortcuts

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