logutil

package
v0.0.0-...-3712671 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2014 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flush

func Flush()

Flush calls the functions registered through OnFlush() and waits for them.

Programs that use servenv.Run*() will invoke Flush() automatically at shutdown. Other programs should defer logutil.Flush() at the beginning of main().

Concurrent calls to Flush are serialized.

func GetSubprocessFlags

func GetSubprocessFlags() []string

GetSubprocessFlags returns the list of flags to use to have subprocesses log in the same directory as the current process.

func OnFlush

func OnFlush(fn func())

OnFlush registers a function to be called when Flush() is invoked.

func PurgeLogs

func PurgeLogs()

PurgeLogs removes any log files that were started more than keepLogs ago and that aren't the current log.

Types

type ThrottledLogger

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

ThrottledLogger will allow logging of messages but won't spam the logs.

func NewThrottledLogger

func NewThrottledLogger(name string, maxInterval time.Duration) *ThrottledLogger

NewThrottledLogger will create a ThrottledLogger with the given name and throttling interval.

func (*ThrottledLogger) Errorf

func (tl *ThrottledLogger) Errorf(format string, v ...interface{})

Errorf logs an error if not throttled.

func (*ThrottledLogger) Infof

func (tl *ThrottledLogger) Infof(format string, v ...interface{})

Infof logs an info if not throttled.

func (*ThrottledLogger) Warningf

func (tl *ThrottledLogger) Warningf(format string, v ...interface{})

Warningf logs a warning if not throttled.

Jump to

Keyboard shortcuts

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