Skip to content

Commit

Permalink
Enable stderr output without debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Bibob7 committed May 12, 2020
1 parent c1f9597 commit faa07a1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
7 changes: 0 additions & 7 deletions cmd/rr/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,6 @@ func init() {
util.ExitWithError(err)
}

wcv, _ := Container.Get(limit.ID)
if wcv, ok := wcv.(*limit.Service); ok {
wcv.AddListener(func(event int, ctx interface{}) {
util.StdErrOutput(event, ctx)
})
}

// global watcher config
if Verbose {
wcv, _ := Container.Get(limit.ID)
Expand Down
10 changes: 7 additions & 3 deletions cmd/rr/http/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ import (

func init() {
cobra.OnInitialize(func() {
if rr.Debug {
svc, _ := rr.Container.Get(rrhttp.ID)
if svc, ok := svc.(*rrhttp.Service); ok {
svc, _ := rr.Container.Get(rrhttp.ID)
if svc, ok := svc.(*rrhttp.Service); ok {
if rr.Debug {
svc.AddListener((&debugger{logger: rr.Logger}).listener)
} else {
svc.AddListener(func(event int, ctx interface{}) {
util.StdErrOutput(event, ctx)
})
}
}
})
Expand Down
3 changes: 1 addition & 2 deletions cmd/util/debug.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package util

import (
"fmt"
"github.com/sirupsen/logrus"
"github.com/spiral/roadrunner"
"strings"
Expand Down Expand Up @@ -35,7 +34,7 @@ func LogEvent(logger *logrus.Logger, event int, ctx interface{}) bool {
continue
}

fmt.Println(strings.Trim(line, "\r\n"))
logger.Warning(strings.Trim(line, "\r\n"))
}

return true
Expand Down

0 comments on commit faa07a1

Please sign in to comment.