ext

package
v0.0.0-...-c063610 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2015 License: Apache-2.0, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorHandler

func ErrorHandler(h log.Handler) log.Handler

ErrorHandler wraps another handler and passes all records through unchanged except if the logged context contains a non-nil error value in its context. Then ErrorHandler will *increase* the log level to LvlError, unless it was already at LvlCrit.

This allows you to log the result of all functions for debugging and capture error conditions when in production with a single log line. Example:

reply, err := redisConn.Do("SET", "foo", "bar")
logger.Debug("Wrote value to redis", "reply", reply, "err", err)
if err != nil {
    return err
}

func RandId

func RandId(idlen int) string

RandId creates a random identifier of the requested length Useful for assigning mostly-unique identifiers for logging and identification that are unlikely to collide because of short lifespan or low set cardinality

Types

This section is empty.

Jump to

Keyboard shortcuts

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