summaryrefslogtreecommitdiff
path: root/cmd/rr/http/debug.go
blob: cae10452d6324a19e53eabbc7b5411b13e1a966b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package http

import (
	rr "github.com/spiral/roadrunner/cmd/rr/cmd"

	"github.com/spf13/cobra"
	"github.com/spiral/roadrunner/service/http"
	"github.com/spiral/roadrunner/cmd/rr/debug"
)

func init(){
	cobra.OnInitialize(func() {
		if rr.Debug {
			svc, _ := rr.Container.Get(http.ID)
			if svc, ok := svc.(*http.Service); ok {
				svc.AddListener(debug.Listener(rr.Logger))
			}
		}
	})
}