Documentation ¶
Index ¶
Constants ¶
const ( // DataDogAgentEnvName contains the name of the environment variable storing the data dog agent host name. DataDogAgentEnvName = "DD_AGENT_HOST" // Default port for datadog statsd. DataDogStatsdPort = 8125 // DataDog counters take a rate value between 0 and 1.0 to sample the counters. // A value of 1.0 means always send the value rather than subsample. // https://statsd.readthedocs.io/en/v3.2.1/types.html#counters DDAlwaysSample = 1.0 )
const ( // Constants to be used with verbosity levels with logr. // Note that with logr the verbosity is additive // e.g. log.V(1).Info() means log at verbosity = info verbosity + 1 Debug = 1 )
Variables ¶
This section is empty.
Functions ¶
func IgnoreError ¶
func IgnoreError(err error)
IgnoreError is a helper function to deal with errors.
func MyCaller ¶
func MyCaller() string
MyCaller returns the caller of the Function in the form ${package}/${file}:${linenumber} e.g. file: somemodule/cmd/parent.go
func parent() { child() }
file: somemodule/cmd/child.go
func child() { c := util.MyCaller() }
The value of c will be "cmd/parent.go:2"
This is useful when you have common error handlers that want to log the location that invoked them.
The function doesn't return the full path of the code because this would be the full path on the machine where it was compiled which isn't useful.
func PrettyString ¶
func PrettyString(v interface{}) string
PrettyString returns a prettily formatted string of the object.
func SetupLogger ¶
SetupLogger performs common setup of a logger.
func StatsdClient ¶
StatsdClient returns a statsdclient initialized from environment variables
func VerbosityDescription ¶
func VerbosityDescription() string
VerbosityDescription returns a string to be used as the description for verbosity flags.
Types ¶
This section is empty.