Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger interface { Infof(format string, args ...interface{}) Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) Info(args ...interface{}) Error(args ...interface{}) Fatal(args ...interface{}) }
Logger interface is used throughout gorush
func NewEmptyLogger ¶
func NewEmptyLogger() Logger
NewEmptyLogger for simple logger.
Example ¶
l := NewEmptyLogger() l.Info("test") l.Infof("test") l.Error("test") l.Errorf("test") l.Fatal("test") l.Fatalf("test")
Output:
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages the graceful shutdown process
func NewManagerWithContext ¶ added in v0.0.2
NewManagerWithContext initial the Manager with custom context
func (*Manager) AddRunningJob ¶
func (g *Manager) AddRunningJob(f RunningJob)
AddRunningJob add running task
func (*Manager) AddShutdownJob ¶ added in v0.0.2
func (g *Manager) AddShutdownJob(f ShtdownJob)
AddShutdownJob add shutdown task
func (*Manager) Done ¶
func (g *Manager) Done() <-chan struct{}
Done allows the manager to be viewed as a context.Context.
func (*Manager) ShutdownContext ¶ added in v0.0.4
ShutdownContext returns a context.Context that is Done at shutdown
type OptionFunc ¶ added in v0.1.0
type OptionFunc func(*Options)
OptionFunc is a function that configures a graceful shutdown.
func (OptionFunc) Apply ¶ added in v0.1.0
func (f OptionFunc) Apply(option *Options)
Apply calls f(option)
type Options ¶ added in v0.1.0
type Options struct {
// contains filtered or unexported fields
}
Options for graceful shutdown
type RunningJob ¶
type ShtdownJob ¶ added in v0.0.2
type ShtdownJob func() error
Click to show internal directories.
Click to hide internal directories.