logboek

package module
v0.3.4 Latest Latest
Warning

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

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

README

logboek

Logging library for cli utils.

Documentation

Index

Constants

View Source
const (
	HighlightStyleName = "highlight"
	DetailsStyleName   = "details"
	FailStyleName      = "fail"
)
View Source
const DefaultWidth = 140

Variables

This section is empty.

Functions

func ContentWidth

func ContentWidth() int

func DisableFitMode added in v0.2.3

func DisableFitMode()

func DisableLogColor

func DisableLogColor()

func DisablePrettyLog

func DisablePrettyLog()

func EnableFitMode added in v0.2.3

func EnableFitMode()

func EnableLogColor

func EnableLogColor()

func ErrF

func ErrF(format string, a ...interface{}) (int, error)

func FitText

func FitText(text string, options FitTextOptions) string

func GetErrStream

func GetErrStream() io.Writer

func GetOutStream

func GetOutStream() io.Writer

func GetRawStreamsOutputMode

func GetRawStreamsOutputMode() bool

func IndentDown

func IndentDown()

func IndentUp

func IndentUp()

func Init

func Init() error

func LogBlock added in v0.1.1

func LogBlock(blockMessage string, options LogBlockOptions, blockFunc func() error) error

func LogErrorF

func LogErrorF(format string, a ...interface{})

func LogErrorLn

func LogErrorLn(a ...interface{})

func LogF

func LogF(format string, a ...interface{})

func LogFWithOptions added in v0.3.1

func LogFWithOptions(options LogFOptions, format string, a ...interface{})

func LogInfoF

func LogInfoF(format string, a ...interface{})

func LogInfoLn

func LogInfoLn(a ...interface{})

func LogLn

func LogLn(a ...interface{})

func LogLnWithOptions added in v0.3.1

func LogLnWithOptions(options LogLnOptions, a ...interface{})

func LogOptionalLn

func LogOptionalLn()

func LogProcess

func LogProcess(processMessage string, options LogProcessOptions, processFunc func() error) error

func LogProcessEnd

func LogProcessEnd(options LogProcessEndOptions)

func LogProcessFail

func LogProcessFail(options LogProcessFailOptions)

func LogProcessInline

func LogProcessInline(processMessage string, options LogProcessInlineOptions, processFunc func() error) error

func LogProcessStart

func LogProcessStart(processMessage string, options LogProcessStartOptions)

func LogProcessStepEnd

func LogProcessStepEnd(processMessage string, options LogProcessStepEndOptions)

func LogWarnF added in v0.3.1

func LogWarnF(format string, a ...interface{})

func LogWarnLn added in v0.3.1

func LogWarnLn(a ...interface{})

func MuteErr

func MuteErr()

func MuteOut

func MuteOut()

func OutF

func OutF(format string, a ...interface{}) (int, error)

func RawStreamsOutputModeOff

func RawStreamsOutputModeOff()

func RawStreamsOutputModeOn

func RawStreamsOutputModeOn()

func ResetPrefix added in v0.2.4

func ResetPrefix()

func SetLevel added in v0.3.1

func SetLevel(l Level)

func SetPrefix added in v0.2.4

func SetPrefix(value string, style *Style)

func SetQuietLevel added in v0.3.1

func SetQuietLevel()

func SetRunningTimePrefix added in v0.3.2

func SetRunningTimePrefix(style *Style)

func SetStreamsLogLevel added in v0.3.1

func SetStreamsLogLevel(logLevel Level)

func SetStyle added in v0.3.1

func SetStyle(name string, style *Style)

func SetTag

func SetTag(value string, style *Style)

func SetWidth

func SetWidth(value int)

func UnmuteErr

func UnmuteErr()

func UnmuteOut

func UnmuteOut()

func WithFitMode added in v0.2.3

func WithFitMode(value bool, decoratedFunc func() error) error

func WithIndent

func WithIndent(f func() error) error

func WithLevel added in v0.3.1

func WithLevel(level Level, f func())

func WithRawStreamsOutputModeOn

func WithRawStreamsOutputModeOn(f func() error) error

func WithStreamsLogLevel added in v0.3.1

func WithStreamsLogLevel(logLevel Level, f func() error) error

func WithTag

func WithTag(value string, style *Style, f func() error) error

func WithoutIndent

func WithoutIndent(decoratedFunc func() error) error

Types

type FitTextOptions

type FitTextOptions struct {
	ExtraIndentWidth int
	Width            int
	MaxWidth         int
	MarkWrappedLine  bool
}

type Level added in v0.3.1

type Level int
const (
	Error Level
	Warn
	Default // 0
	Info
	Debug
)

func (Level) IsAccepted added in v0.3.1

func (l Level) IsAccepted() bool

func (Level) LogBlock added in v0.3.1

func (l Level) LogBlock(blockMessage string, options LevelLogBlockOptions, processFunc func() error) error

func (Level) LogF added in v0.3.1

func (l Level) LogF(format string, a ...interface{})

func (Level) LogFDetails added in v0.3.1

func (l Level) LogFDetails(format string, a ...interface{})

func (Level) LogFHighlight added in v0.3.1

func (l Level) LogFHighlight(format string, a ...interface{})

func (Level) LogFWithCustomStyle added in v0.3.1

func (l Level) LogFWithCustomStyle(style *Style, format string, a ...interface{})

func (Level) LogLn added in v0.3.1

func (l Level) LogLn(a ...interface{})

func (Level) LogLnDetails added in v0.3.1

func (l Level) LogLnDetails(a ...interface{})

func (Level) LogLnHighlight added in v0.3.1

func (l Level) LogLnHighlight(a ...interface{})

func (Level) LogLnWithCustomStyle added in v0.3.1

func (l Level) LogLnWithCustomStyle(style *Style, a ...interface{})

func (Level) LogOptionalLn added in v0.3.2

func (l Level) LogOptionalLn()

func (Level) LogProcess added in v0.3.1

func (l Level) LogProcess(processMessage string, options LevelLogProcessOptions, processFunc func() error) error

func (Level) LogProcessEnd added in v0.3.1

func (l Level) LogProcessEnd(options LevelLogProcessEndOptions)

func (Level) LogProcessFail added in v0.3.1

func (l Level) LogProcessFail(options LevelLogProcessFailOptions)

func (Level) LogProcessInline added in v0.3.1

func (l Level) LogProcessInline(processMessage string, options LevelLogProcessInlineOptions, processFunc func() error) error

func (Level) LogProcessStart added in v0.3.1

func (l Level) LogProcessStart(processMessage string, options LevelLogProcessStartOptions)

func (Level) LogProcessStepEnd added in v0.3.1

func (l Level) LogProcessStepEnd(processMessage string, options LevelLogProcessStepEndOptions)

func (Level) ResetStream added in v0.3.1

func (l Level) ResetStream()

func (Level) SetStream added in v0.3.1

func (l Level) SetStream(stream io.Writer)

func (Level) SetStyle added in v0.3.1

func (l Level) SetStyle(style *Style)

func (Level) Stream added in v0.3.1

func (l Level) Stream() io.Writer

func (Level) String added in v0.3.1

func (l Level) String() string

func (Level) Style added in v0.3.1

func (l Level) Style() *Style

type LevelLogBlockOptions added in v0.3.1

type LevelLogBlockOptions struct {
	WithIndent           bool
	WithoutLogOptionalLn bool
	Style                *Style
}

type LevelLogProcessEndOptions added in v0.3.1

type LevelLogProcessEndOptions struct {
	WithoutLogOptionalLn bool
	WithoutElapsedTime   bool
	Style                *Style
}

type LevelLogProcessFailOptions added in v0.3.1

type LevelLogProcessFailOptions struct {
	LevelLogProcessEndOptions
}

type LevelLogProcessInlineOptions added in v0.3.1

type LevelLogProcessInlineOptions struct {
	Style *Style
}

type LevelLogProcessOptions added in v0.3.1

type LevelLogProcessOptions struct {
	WithIndent             bool
	WithoutLogOptionalLn   bool
	WithoutElapsedTime     bool
	InfoSectionFunc        func(err error)
	SuccessInfoSectionFunc func()
	Style                  *Style
}

type LevelLogProcessStartOptions added in v0.3.1

type LevelLogProcessStartOptions struct {
	Style *Style
}

type LevelLogProcessStepEndOptions added in v0.3.1

type LevelLogProcessStepEndOptions struct {
	WithIndent      bool
	InfoSectionFunc func(err error)
	Style           *Style
}

type LogBlockOptions added in v0.1.1

type LogBlockOptions struct {
	LevelLogBlockOptions
	Level Level
}

type LogFOptions added in v0.3.1

type LogFOptions struct {
	LogOptions
}

type LogLnOptions added in v0.3.1

type LogLnOptions struct {
	LogOptions
}

type LogOptions added in v0.3.1

type LogOptions struct {
	Level Level
	Style *Style
}

type LogProcessEndOptions

type LogProcessEndOptions struct {
	LevelLogProcessEndOptions
	Level Level
}

type LogProcessFailOptions added in v0.3.1

type LogProcessFailOptions struct {
	LevelLogProcessFailOptions
	Level Level
}

type LogProcessInlineOptions

type LogProcessInlineOptions struct {
	LevelLogProcessInlineOptions
	Level Level
}

type LogProcessOptions

type LogProcessOptions struct {
	LevelLogProcessOptions
	Level Level
}

type LogProcessStartOptions

type LogProcessStartOptions struct {
	LevelLogProcessStartOptions
	Level Level
}

type LogProcessStepEndOptions

type LogProcessStepEndOptions struct {
	LevelLogProcessStepEndOptions
	Level Level
}

type Style added in v0.3.1

type Style struct {
	Attributes []color.Attribute
}

func DetailsStyle added in v0.3.1

func DetailsStyle() *Style

func HighlightStyle added in v0.3.1

func HighlightStyle() *Style

func StyleByName added in v0.3.1

func StyleByName(name string) *Style

func (*Style) Colorize added in v0.3.1

func (s *Style) Colorize(format string, a ...interface{}) string

type WriterProxy

type WriterProxy struct {
	io.Writer
}

func (WriterProxy) Write

func (p WriterProxy) Write(data []byte) (int, error)

Directories

Path Synopsis
playground

Jump to

Keyboard shortcuts

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