nod

package module
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 10 Imported by: 41

README

nod

Documentation

Index

Constants

View Source
const (
	StdOut  = "stdout"
	StdErr  = "stderr"
	FileLog = "file_log"
)
View Source
const (
	TimeFormat = "2006-01-02-15-04-05"
)

Variables

This section is empty.

Functions

func Begin

func Begin(format string, d ...interface{}) *activity

func DisableOutput added in v0.1.7

func DisableOutput(output string)

func EnableFileLogger added in v0.1.5

func EnableFileLogger(dir string) (io.Closer, error)

func EnableOutput added in v0.1.7

func EnableOutput(output string)

func EnableStdErrLogger added in v0.1.5

func EnableStdErrLogger()

func EnableStdOutPresenter added in v0.1.5

func EnableStdOutPresenter()

func Error

func Error(err error) error

func ErrorStr added in v0.1.18

func ErrorStr(format string, d ...interface{}) string

func HandleFunc

func HandleFunc(handler Handler, output string)

func Increment added in v0.1.20

func Increment(tpw TotalProgressWriter)

func Log

func Log(format string, d ...interface{})

func QueueBegin added in v0.1.5

func QueueBegin(format string, d ...interface{}) *queue

func RequestLog added in v0.1.12

func RequestLog(h http.Handler) http.Handler

RequestLog is a trivial logging middleware that logs the URL of the request

func TotalInt added in v0.1.20

func TotalInt(tpw TotalProgressWriter, total int)

Types

type ActCloser added in v0.1.5

type ActCloser interface {
	Log(string, ...interface{})
	End()
	Error(error)
	EndWithResult(string, ...interface{})
	EndWithError(error) error
	EndWithSummary(string, map[string][]string)
}

type Handler added in v0.1.4

type Handler interface {
	Handle(msgType MessageType, payload interface{}, topic string)
	Close() error
}

type MessageType

type MessageType int
const (
	//MsgNone is a message type initial value. No payload
	MsgNone MessageType = iota
	//MsgBegin signals start of an activity. No payload
	MsgBegin
	//MsgError provides not-fatal error that happened during activity execution. Payload: error
	MsgError
	//MsgTotal sets expected total value of an activity progress. Payload: uint64
	MsgTotal
	//MsgCurrent updates current value of an activity progress. Payload: uint64
	MsgCurrent
	//MsgLog sends a value useful for logging. Payload: string
	MsgLog
	//MsgResult provides result of an activity. Payload type: string
	MsgResult
	//MsgSummary provides map of categorized results. Payload: headingSections
	MsgSummary
	//MsgEnd signals completion of an activity. No payload
	MsgEnd
)

func (MessageType) String added in v0.1.5

func (mt MessageType) String() string

type Queue added in v0.1.5

type Queue interface {
	Flush()
	Discard()
}

type TotalProgressWriter added in v0.1.4

type TotalProgressWriter interface {
	Total(uint64)
	Current(uint64)
	Progress(uint64)
	TotalInt(int)
	CurrentInt(int)
	ProgressInt(int)
	Increment()
	io.Writer
	ActCloser
}

func NewProgress added in v0.1.5

func NewProgress(format string, d ...interface{}) TotalProgressWriter

Jump to

Keyboard shortcuts

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