diff --git a/internal/server/dispatcher.go b/internal/server/dispatcher.go index f30f431..ee2787a 100644 --- a/internal/server/dispatcher.go +++ b/internal/server/dispatcher.go @@ -76,7 +76,7 @@ func (di *Dispatcher) ServeHTTP(w http.ResponseWriter, req *http.Request) { return } - log.Infof("New request: %s %s\n", req.Method, req.URL.String()) + log.Infof("\033[35mNew request:\033[0m %s %s\n", req.Method, req.URL.String()) mock, transaction := di.getMatchingResult(&mRequest) @@ -138,9 +138,16 @@ func getProxyResponse(request *mock.Request, definition *mock.Definition) *mock. func (di *Dispatcher) getMatchingResult(request *mock.Request) (*mock.Definition, *match.Transaction) { var response *mock.Response + var colour = "\033[31m" + var stop_colour = "\033[0m" mock, result := di.Resolver.Resolve(request) - log.Infof("Definition match found: %s. Name : %s\n", strconv.FormatBool(result.Found), mock.URI) + if result.Found { + colour = "\033[32m" + } + + log.Infof("%sDefinition match found:%s%s. Name : %s\n", colour, stop_colour, strconv.FormatBool(result.Found), mock.URI) + if result.Found { if len(mock.Control.ProxyBaseURL) > 0 { diff --git a/internal/server/router.go b/internal/server/router.go index 095d714..be2c4ef 100644 --- a/internal/server/router.go +++ b/internal/server/router.go @@ -50,6 +50,7 @@ func (rr *Router) Resolve(req *mock.Request) (*mock.Definition, *match.Result) { mLog.Errors = make([]match.Error, 0, len(mocks)) for _, m := range mocks { + log.Debugf("\033[34mConsidering:\033[0m %s", m.URI) r, err := rr.Checker.Match(req, &m, true) if r { //we return a copy of it, not the config itself because we will working on it. @@ -61,7 +62,7 @@ func (rr *Router) Resolve(req *mock.Request) (*mock.Definition, *match.Result) { } mLog.Errors = append(mLog.Errors, match.Error{URI: m.URI, Reason: err.Error()}) if !errors.Is(err, match.ErrPathNotMatch) { - log.Infof("Discarding mock: %s Reason: %s\n", m.URI, err.Error()) + log.Infof("\033[31mDiscarding mock:\033[0m %s Reason: %s\n", m.URI, err.Error()) } } return getNotFoundResult(), mLog