sender

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2020 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CustomOutput func(wOut io.Writer, wErr io.Writer) Notice = func(wOut io.Writer, wErr io.Writer) Notice {
	return func(message interface{}, statusCode int, progs ...*notice.Progress) error {
		if len(progs) > 0 && progs[0] != nil {
			message = `[ ` + tplfunc.NumberFormat(progs[0].CalcPercent().Percent, 2) + `% ] ` + fmt.Sprint(message)
		}
		if statusCode > 0 {
			fmt.Fprintln(wOut, message)
		} else {
			fmt.Fprintln(wErr, message)
		}
		return nil
	}
}

Functions

This section is empty.

Types

type Notice

type Notice func(message interface{}, statusCode int, progress ...*notice.Progress) error
var Default Notice = func(message interface{}, statusCode int, progs ...*notice.Progress) error {
	if len(progs) > 0 && progs[0] != nil {
		message = `[ ` + tplfunc.NumberFormat(progs[0].CalcPercent().Percent, 2) + `% ] ` + fmt.Sprint(message)
	}
	if statusCode > 0 {
		log.Info(message)
	} else {
		log.Error(message)
	}
	return nil
}

Jump to

Keyboard shortcuts

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