summaryrefslogtreecommitdiff
path: root/cmd/rr/http/debug.go
blob: f69e10a8bc6444ea803ceae98fce6297795717e9 (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/cmd/rr/debug"
	"github.com/spiral/roadrunner/service/http"
)

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))
			}
		}
	})
}