more debuglevel code cleanup
This commit is contained in:
parent
fcdff1039f
commit
5c50f4ac95
2
main.go
2
main.go
@ -118,7 +118,7 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
srv := server.NewServer(cfg, *debuglvl)
|
||||
srv := server.NewServer(cfg)
|
||||
|
||||
r, err := srv.Start()
|
||||
if err != nil {
|
||||
|
@ -13,7 +13,6 @@ type Server struct {
|
||||
workers []*worker
|
||||
cfg *config.Config
|
||||
shutdownc chan bool
|
||||
debuglvl int
|
||||
http http.Server
|
||||
}
|
||||
|
||||
@ -35,7 +34,7 @@ func (srv *Server) Start() (bool, error) {
|
||||
for {
|
||||
select {
|
||||
case r := <-t.C:
|
||||
if srv.debuglvl > 0 {
|
||||
if srv.cfg.DebugLevel > 0 {
|
||||
fmt.Printf("interval check at %s\n", r)
|
||||
}
|
||||
for _, w := range srv.workers {
|
||||
@ -51,15 +50,14 @@ func (srv *Server) Start() (bool, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func NewServer(cfg *config.Config, debuglvl int) *Server {
|
||||
func NewServer(cfg *config.Config) *Server {
|
||||
srv := &Server{
|
||||
cfg: cfg,
|
||||
debuglvl: debuglvl,
|
||||
shutdownc: make(chan bool, 1),
|
||||
}
|
||||
for _, g := range cfg.Groups {
|
||||
srv.workers = append(
|
||||
srv.workers, makeworker(g, debuglvl),
|
||||
srv.workers, makeworker(g, cfg.DebugLevel),
|
||||
)
|
||||
}
|
||||
return srv
|
||||
|
Loading…
Reference in New Issue
Block a user