internal

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseAll

func CloseAll(c []io.Closer) error

CloseAll closes all supplied closers, returns the first error, and logs all errors.

func CopyBytes

func CopyBytes(p []byte) []byte

CopyBytes returns a copy of p

func Debugf

func Debugf(conf *config.Config, s string, args ...interface{})

Debugf prints a debug log message to stdout

func DebugfDepth

func DebugfDepth(conf *config.Config, depth int, s string, args ...interface{})

DebugfDepth prints a debug log message to stdout

func DiscardError

func DiscardError(err error)

DiscardError does nothing with an error. Used for linting really

func IgnoreError

func IgnoreError(verbose bool, err error)

IgnoreError logs the error if one occurred

func LogAndReturnError

func LogAndReturnError(err error) error

LogAndReturnError logs the error if one occurred, then returns the error

func LogError

func LogError(err error)

LogError logs the error if one occurred

func Logf

func Logf(s string, args ...interface{})

Logf logs to stdout

func NewReadLogger added in v0.1.1

func NewReadLogger(prefix string, r io.Reader, depth int) io.Reader

NewReadLogger returns a reader that behaves like r except that it logs (using log.Printf) each read to standard error, printing the prefix and the data read.

func PanicOnError

func PanicOnError(err error)

PanicOnError panics if an error is passed.

func Prettybuf

func Prettybuf(bufs ...[]byte) []byte

Prettybuf returns a human readable representation of a buffer that fits more or less on a log line

Types

type LifecycleManager

type LifecycleManager interface {
	Setup() error
	Shutdown() error
}

LifecycleManager handles application startup / shutdown for loggers and servers.

type LogFile

type LogFile struct {
	*os.File
	// contains filtered or unexported fields
}

func NewLogFile

func NewLogFile(f *os.File) *LogFile

func (*LogFile) AsFile

func (lf *LogFile) AsFile() *LogFile

func (*LogFile) Close

func (lf *LogFile) Close() error

func (*LogFile) SetLimit

func (lf *LogFile) SetLimit(limit int64)

func (*LogFile) SizeLimit

func (lf *LogFile) SizeLimit() (int64, int64, error)

func (*LogFile) WithClose

func (lf *LogFile) WithClose(closefn func()) *LogFile

type Stats

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

Stats is a struct containing internal counters

func NewStats

func NewStats() *Stats

NewStats returns a new instance of Stats

func (*Stats) Add

func (s *Stats) Add(key string, val int64)

func (*Stats) Bytes

func (s *Stats) Bytes() []byte

func (*Stats) Decr

func (s *Stats) Decr(key string)

func (*Stats) Incr

func (s *Stats) Incr(key string)

func (*Stats) Set

func (s *Stats) Set(key string, val int64)

Jump to

Keyboard shortcuts

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