Documentation ¶
Overview ¶
Package cmdutil contains utility methods that are useful for command-line programs.
Index ¶
- Constants
- Variables
- func Err(a ...zero.Interface) (n int, err error)
- func Errf(format string, a ...zero.Interface) (n int, err error)
- func Errln(a ...zero.Interface) (n int, err error)
- func Fatal(a ...zero.Interface)
- func Fatalf(format string, a ...zero.Interface)
- func Fatalln(a ...zero.Interface)
- func InitSentry(opts ...SentryOption)
- func Must(err error)
- func NewLogger(opts ...LogrusOption) *logrus.Entry
- func NewRaven(opts ...SentryOption) *raven.Client
- func NewSentry(opts ...SentryOption) *sentry.Client
- type LogrusConfig
- type LogrusOption
- type SentryConfig
- type SentryOption
Constants ¶
const ( EnvLogrusLevel = "LOGRUS_LEVEL" EnvLogrusFormat = "LOGRUS_FORMAT" )
Logrus-related environment keys.
const ( LogrusFormatJSON = "json" LogrusFormatText = "text" )
Valid environment values for the key EnvLogrusFormat.
const (
EnvSentryDSN = "SENTRY_DSN"
)
Raven and Sentry-related environment variables.
Variables ¶
var FatalExitCode = 1
FatalExitCode is the exit code that all Fatal* methods exit with after printing.
Functions ¶
func InitSentry ¶ added in v0.4.3
func InitSentry(opts ...SentryOption)
InitSentry initializes the current sentry.Hub.
func Must ¶
func Must(err error)
Must panics if err is not nil.
It is used to wrap side-effect-inducing function calls that return an error.
func NewLogger ¶ added in v0.4.1
func NewLogger(opts ...LogrusOption) *logrus.Entry
NewLogger creates an application-level logrus.Entry.
func NewRaven ¶ added in v0.4.1
func NewRaven(opts ...SentryOption) *raven.Client
NewRaven creates a new raven.Client.
func NewSentry ¶ added in v0.4.2
func NewSentry(opts ...SentryOption) *sentry.Client
NewSentry creates a new sentry.Client.
Types ¶
type LogrusConfig ¶ added in v0.4.1
type LogrusConfig struct { // Logging-related options. Output io.Writer TextFormatter logrus.TextFormatter JSONFormatter logrus.JSONFormatter // Extensions-related options. Raven *raven.Client }
A LogrusConfig configures a logrus.Logger.
type LogrusOption ¶ added in v0.4.1
type LogrusOption func(*LogrusConfig)
A LogrusOption modifies a LogrusConfig.
func WithSentryHook ¶ added in v0.4.5
func WithSentryHook(rc *raven.Client) LogrusOption
WithSentryHook adds a Sentry reporting hook to a logrus.Logger.
type SentryConfig ¶ added in v0.4.3
type SentryConfig struct {
Release string
}
SentryConfig configures a raven.Client.
type SentryOption ¶ added in v0.4.2
type SentryOption func(*SentryConfig)
A SentryOption modifies a RavenConfig.
func WithRelease ¶ added in v0.4.5
func WithRelease(release string) SentryOption
WithRelease sets the release tag for a sentry.Client.