diff options
author | Wolfy-J <[email protected]> | 2018-06-10 21:17:54 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-10 21:17:54 +0300 |
commit | 7cc6d00a1c350eb3147ede00802d312d4be94dee (patch) | |
tree | ac1391c831d4366b477e61b57e095a1dfeafbbb7 /cmd/rr/main.go | |
parent | e9203e05a7f3278a8080d0f69e6640e5d3d1042d (diff) |
debug is not service anymore
Diffstat (limited to 'cmd/rr/main.go')
-rw-r--r-- | cmd/rr/main.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/cmd/rr/main.go b/cmd/rr/main.go index 6065d3d1..945b8fa0 100644 --- a/cmd/rr/main.go +++ b/cmd/rr/main.go @@ -32,9 +32,13 @@ import ( // cli plugins _ "github.com/spiral/roadrunner/cmd/rr/http" - "github.com/spiral/roadrunner/debug" + "github.com/spiral/roadrunner/cmd/rr/debug" + + "github.com/spf13/cobra" ) +var debugMode bool + func main() { // provides ability to make local connection to services rr.Container.Register(rpc.Name, &rpc.Service{}) @@ -46,7 +50,15 @@ func main() { rr.Container.Register(static.Name, &static.Service{}) // provides additional verbosity - rr.Container.Register(debug.Name, &debug.Service{Logger: rr.Logger}) + + // debug mode + rr.CLI.PersistentFlags().BoolVarP(&debugMode, "debug", "d", false, "debug mode", ) + cobra.OnInitialize(func() { + if debugMode { + service, _ := rr.Container.Get(http.Name) + service.(*http.Service).AddListener(debug.NewListener(rr.Logger).Listener) + } + }) // you can register additional commands using cmd.CLI rr.Execute() |