Documentation ¶
Overview ¶
Package gaper implements a supervisor restarts a go project when it crashes or a watched file changes
Index ¶
- Constants
- Variables
- func Run(cfg *Config, chOSSiginal chan os.Signal) error
- type Builder
- type Config
- type LoggerEntity
- func (l *LoggerEntity) Debug(v ...interface{})
- func (l *LoggerEntity) Debugf(format string, v ...interface{})
- func (l *LoggerEntity) Error(v ...interface{})
- func (l *LoggerEntity) Errorf(format string, v ...interface{})
- func (l *LoggerEntity) Info(v ...interface{})
- func (l *LoggerEntity) Verbose(verbose bool)
- type Runner
- type Watcher
- type WatcherConfig
Constants ¶
const OSWindows = "windows"
OSWindows is used to check if current OS is a Windows
Variables ¶
var ( NoRestartOnError = "error" NoRestartOnSuccess = "success" NoRestartOnExit = "exit" )
No restart types
var DefaultBuildPath = "."
DefaultBuildPath is the default build and watched path
var DefaultExtensions = []string{"go"}
DefaultExtensions is the default watched extension
var DefaultPoolInterval = 500
DefaultPoolInterval is the time in ms used by the watcher to wait between scans
Functions ¶
Types ¶
type Config ¶
type Config struct { BinName string BuildPath string BuildArgs []string BuildArgsMerged string ProgramArgs []string ProgramArgsMerged string WatchItems []string IgnoreItems []string PollInterval int Extensions []string NoRestartOn string DisableDefaultIgnore bool WorkingDirectory string }
Config contains all settings supported by gaper
type LoggerEntity ¶ added in v1.0.2
type LoggerEntity struct {
// contains filtered or unexported fields
}
LoggerEntity used by gaper
func Logger ¶
func Logger() *LoggerEntity
Logger give access to external packages to use gaper logger
func (*LoggerEntity) Debug ¶ added in v1.0.2
func (l *LoggerEntity) Debug(v ...interface{})
Debug logs a debug message
func (*LoggerEntity) Debugf ¶ added in v1.0.2
func (l *LoggerEntity) Debugf(format string, v ...interface{})
Debugf logs a debug message with format
func (*LoggerEntity) Error ¶ added in v1.0.2
func (l *LoggerEntity) Error(v ...interface{})
Error logs an error message
func (*LoggerEntity) Errorf ¶ added in v1.0.2
func (l *LoggerEntity) Errorf(format string, v ...interface{})
Errorf logs and error message with format
func (*LoggerEntity) Info ¶ added in v1.0.2
func (l *LoggerEntity) Info(v ...interface{})
Info logs a info message
func (*LoggerEntity) Verbose ¶ added in v1.0.2
func (l *LoggerEntity) Verbose(verbose bool)
Verbose toggle this logger verbosity
type Runner ¶
type Runner interface { Run() (*exec.Cmd, error) Kill() error Errors() chan error Exited() bool IsRunning() bool ExitStatus(err error) int }
Runner is a interface for the run process
type Watcher ¶
Watcher is a interface for the watch process
func NewWatcher ¶
func NewWatcher(cfg WatcherConfig) (Watcher, error)
NewWatcher creates a new watcher