diff options
Diffstat (limited to 'cmd/rr/debug/debugger.go')
-rw-r--r-- | cmd/rr/debug/debugger.go | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/cmd/rr/debug/debugger.go b/cmd/rr/debug/debugger.go index ed9a1a56..5b1d586b 100644 --- a/cmd/rr/debug/debugger.go +++ b/cmd/rr/debug/debugger.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/sirupsen/logrus" "github.com/spiral/roadrunner" - "github.com/spiral/roadrunner/cmd/rr/utils" + "github.com/spiral/roadrunner/cmd/rr/util" rrhttp "github.com/spiral/roadrunner/service/http" "net/http" "strings" @@ -24,7 +24,7 @@ func (s *debugger) listener(event int, ctx interface{}) { switch event { case rrhttp.EventResponse: e := ctx.(*rrhttp.ResponseEvent) - s.logger.Info(utils.Sprintf( + s.logger.Info(util.Sprintf( "<cyan+h>%s</reset> %s <white+hb>%s</reset> %s", e.Request.RemoteAddr, statusColor(e.Response.Status), @@ -35,14 +35,14 @@ func (s *debugger) listener(event int, ctx interface{}) { e := ctx.(*rrhttp.ErrorEvent) if _, ok := e.Error.(roadrunner.JobError); ok { - s.logger.Info(utils.Sprintf( + s.logger.Info(util.Sprintf( "%s <white+hb>%s</reset> %s", statusColor(500), e.Request.Method, uri(e.Request), )) } else { - s.logger.Info(utils.Sprintf( + s.logger.Info(util.Sprintf( "%s <white+hb>%s</reset> %s <red>%s</reset>", statusColor(500), e.Request.Method, @@ -55,13 +55,13 @@ func (s *debugger) listener(event int, ctx interface{}) { switch event { case roadrunner.EventWorkerKill: w := ctx.(*roadrunner.Worker) - s.logger.Warning(utils.Sprintf( + s.logger.Warning(util.Sprintf( "<white+hb>worker.%v</reset> <yellow>killed</red>", *w.Pid, )) case roadrunner.EventWorkerError: err := ctx.(roadrunner.WorkerError) - s.logger.Error(utils.Sprintf( + s.logger.Error(util.Sprintf( "<white+hb>worker.%v</reset> <red>%s</reset>", *err.Worker.Pid, err.Caused, @@ -71,7 +71,7 @@ func (s *debugger) listener(event int, ctx interface{}) { // outputs switch event { case roadrunner.EventStderrOutput: - s.logger.Warning(utils.Sprintf( + s.logger.Warning(util.Sprintf( "<yellow>%s</reset>", strings.Trim(string(ctx.([]byte)), "\r\n"), )) @@ -80,15 +80,15 @@ func (s *debugger) listener(event int, ctx interface{}) { // rr server events switch event { case roadrunner.EventServerFailure: - s.logger.Error(utils.Sprintf("<red>server is dead</reset>")) + s.logger.Error(util.Sprintf("<red>server is dead</reset>")) } // pool events switch event { case roadrunner.EventPoolConstruct: - s.logger.Debug(utils.Sprintf("<cyan>new worker pool</reset>")) + s.logger.Debug(util.Sprintf("<cyan>new worker pool</reset>")) case roadrunner.EventPoolError: - s.logger.Error(utils.Sprintf("<red>%s</reset>", ctx)) + s.logger.Error(util.Sprintf("<red>%s</reset>", ctx)) } //s.logger.Warning(event, ctx) @@ -96,18 +96,18 @@ func (s *debugger) listener(event int, ctx interface{}) { func statusColor(status int) string { if status < 300 { - return utils.Sprintf("<green>%v</reset>", status) + return util.Sprintf("<green>%v</reset>", status) } if status < 400 { - return utils.Sprintf("<cyan>%v</reset>", status) + return util.Sprintf("<cyan>%v</reset>", status) } if status < 500 { - return utils.Sprintf("<yellow>%v</reset>", status) + return util.Sprintf("<yellow>%v</reset>", status) } - return utils.Sprintf("<red>%v</reset>", status) + return util.Sprintf("<red>%v</reset>", status) } // uri fetches full uri from request in a form of string (including https scheme if TLS connection is enabled). |