gooseberry: github.com/voicera/gooseberry Index | Examples | Files | Directories

package gooseberry

import "github.com/voicera/gooseberry"

Package gooseberry provides common Go libraries to import in other Go projects.

Code:

originalLogger := Logger
defer func() { Logger = originalLogger }()

Logger = &testutil.Logger{InDebugMode: true}
fmt.Printf("Logger: %T, IsDebugEnabled: %t\n", Logger, Logger.IsDebugEnabled())
for _, log := range []func(string, ...interface{}){Logger.Debug, Logger.Info, Logger.Warn, Logger.Error} {
    log("message", "answer", 42)
}

Output:

Logger: *testutil.Logger, IsDebugEnabled: true
[Debug] message: [answer 42]
[Info] message: [answer 42]
[Warn] message: [answer 42]
[Error] message: [answer 42]

Index

Examples

Package Files

gooseberry.go

Variables

var Logger log.LeveledLogger = &log.NoOpLogger{}

Logger provides a hook for importing applications to wire up their own logger for gooseberry to use. By default, logging in gooseberry is a NOOP. Optionally, one can set this logger to zap.Logger from the log/zap package.

Directories

PathSynopsis
errorsPackage errors provides utilities for error handling.
logPackage log provides a logger interface so that logging in gooseberry is pluggable; gooseberry provides a wrapper for https://go.uber.org/zap that implements said interface.
log/zapPackage zap provides a wrapper for https://go.uber.org/zap that implements the log.LeveledLogger interface and adds convenience features to logging with zap.
mustPackage must provides functions used in package and variables initialization.
pollingPackage polling provides cost-effective ways to reduce cost of polling resources.
regexPackage regex provides regular expressions utilities.
testutilPackage testutil provide test utilities for testing common packages.
urnPackage urn provides a Uniform Resource Name that implemnets RFC8141.
validatePackage validate provides utilities for commonly-used validation purposes (e.g., for input validation).
webPackage web provides utilities for sending and receiving data via the web.
web/restPackage rest provides REST clients.

Package gooseberry imports 1 packages (graph) and is imported by 2 packages. Updated 2018-04-15. Refresh now. Tools for package owners.