gooseberry: Index | Examples | Files | Directories

package gooseberry

import ""

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


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)


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



Package Files



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.


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 that implements said interface.
log/zapPackage zap provides a wrapper for 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-12-23. Refresh now. Tools for package owners.