Commit dd84fb56 by bergquist

style(dataproxy): renames log functions

parent 51bca7d8
......@@ -19,7 +19,7 @@ import (
)
var (
auditLogger log.Logger = log.New("data-proxy-log")
dataproxyLogger log.Logger = log.New("data-proxy-log")
)
func NewReverseProxy(ds *m.DataSource, proxyPath string, targetUrl *url.URL) *httputil.ReverseProxy {
......@@ -129,14 +129,15 @@ func ProxyDataSourceRequest(c *middleware.Context) {
return
}
proxyLog(ds.Type, c)
logProxyRequest(ds.Type, c)
proxy.ServeHTTP(c.Resp, c.Req.Request)
c.Resp.Header().Del("Set-Cookie")
}
func proxyLog(dataSourceType string, c *middleware.Context) {
if setting.DataProxyLogging {
func logProxyRequest(dataSourceType string, c *middleware.Context) {
if !setting.DataProxyLogging {
return
}
var body string
if c.Req.Request.Body != nil {
......@@ -144,14 +145,14 @@ func proxyLog(dataSourceType string, c *middleware.Context) {
c.Req.Request.Body = ioutil.NopCloser(bytes.NewBuffer(buffer))
body = string(buffer)
}
auditLogger.Info("Proxying incoming request",
"userid", c.UserId,
"orgid", c.OrgId,
"username", c.Login,
"datasource", dataSourceType,
"uri", c.Req.RequestURI,
"method", c.Req.Request.Method,
"body", body)
}
dataproxyLogger.Info("Proxying incoming request",
"userid", c.UserId,
"orgid", c.OrgId,
"username", c.Login,
"datasource", dataSourceType,
"uri", c.Req.RequestURI,
"method", c.Req.Request.Method,
"body", body)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment