<commit_before>package restful

import (
	"bytes"
	"crypto/md5"
	"encoding/base64"
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"net/http/httptest"
	"net/url"
	"strconv"
	"strings"
	"time"

	"github.com/julienschmidt/httprouter"
	"github.com/opentable/sous/util/logging"
	"github.com/opentable/sous/util/logging/messages"
)

type (
	// The MetaHandler collects common behavior for route handlers.
	MetaHandler struct {
		router        *httprouter.Router
		statusHandler *StatusMiddleware
		logging.LogSink
	}

	// ResponseWriter wraps the the http.ResponseWriter interface.
	// XXX This is a workaround for Psyringe
	ResponseWriter struct {
		http.ResponseWriter
	}

	// ExchangeLogger wraps and logs the exchange.
	ExchangeLogger struct {
		Exchanger Exchanger
		logging.LogSink
		*http.Request
		httprouter.Params
	}

	// Injector is an interface for DI systems.
	Injector interface {
		Inject(...interface{}) error
		MustInject(...interface{})
		Add(...interface{})
	}
)

// Exchange implements Exchanger on ExchangeLogger.
func (xlog *ExchangeLogger) Exchange() (data interface{}, status int) {
	xlog.Vomitf("Server: <- %s %s params: %v", xlog.Method, xlog.URL.String(), xlog.Params)
	data, status = xlog.Exchanger.Exchange()
	xlog.Vomitf("Server: -> %d: %#v", status, data)
	return
}

type loggingResponseWriter struct {
	http.ResponseWriter
	req          *http.Request
	log          logging.LogSink
	resourceName string
	start        time.Time
	statusCode   int
}
<commit_msg>Update to use ReportMsg instead of Vomitf<commit_after>package restful

import (
	"bytes"
	"crypto/md5"
	"encoding/base64"
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"net/http/httptest"
	"net/url"
	"strconv"
	"strings"
	"time"

	"github.com/julienschmidt/httprouter"
	"github.com/opentable/sous/util/logging"
	"github.com/opentable/sous/util/logging/messages"
)

type (
	// The MetaHandler collects common behavior for route handlers.
	MetaHandler struct {
		router        *httprouter.Router
		statusHandler *StatusMiddleware
		logging.LogSink
	}

	// ResponseWriter wraps the the http.ResponseWriter interface.
	// XXX This is a workaround for Psyringe
	ResponseWriter struct {
		http.ResponseWriter
	}

	// ExchangeLogger wraps and logs the exchange.
	ExchangeLogger struct {
		Exchanger Exchanger
		logging.LogSink
		*http.Request
		httprouter.Params
	}

	// Injector is an interface for DI systems.
	Injector interface {
		Inject(...interface{}) error
		MustInject(...interface{})
		Add(...interface{})
	}
)

// Exchange implements Exchanger on ExchangeLogger.
func (xlog *ExchangeLogger) Exchange() (data interface{}, status int) {
	logging.ReportMsg(xlog.LogSink, logging.DebugLevel, fmt.Sprintf("Server: <- %s %s params: %v", xlog.Method, xlog.URL.String(), xlog.Params))
	data, status = xlog.Exchanger.Exchange()
	logging.ReportMsg(xlog.LogSink, logging.DebugLevel, fmt.Sprintf("Server: -> %d: %#v", status, data))
	return
}

type loggingResponseWriter struct {
	http.ResponseWriter
	req          *http.Request
	log          logging.LogSink
	resourceName string
	start        time.Time
	statusCode   int
}

{'fraction_non_alphanumeric': 0.11794871794871795, 'fraction_numerical': 0.0019230769230769232, 'mean_word_length': 3.77947932618683, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3270773', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1063, 'n_words': 252}